How to make bootstrap icon display inline with text in a tag?

前端 未结 3 732
太阳男子
太阳男子 2021-02-13 14:05

I have bootstrap navigation pill that shows text and an arrow. Unfortunately if the text is to long the arrow appears on the border of the anchor. Html looks like this.

相关标签:
3条回答
  • If your text can wrap as you said then this can work..

    <span><i class="pull-right icon-chevron-right"></i>Some longer sample text</span>
    

    Update:

    <span class="iwt">
    <span>Some longer sample text</span>
    <i class="pull-right icon-chevron-right"></i>
    </span>
    
    .iwt{
    display:block;
    }
    
    0 讨论(0)
  • 2021-02-13 14:44

    Please use this structure

    <a href="#">
           <i class="pull-right icon-chevron-right"></i>
          <span> Some longer sample text</span>
    
        </a>
    

    Please demo http://jsfiddle.net/FNcGX/9/

    0 讨论(0)
  • 2021-02-13 14:56

    Using css white-space:nowrap; solves text in one line issue.

    .subject-pill > a {
        border-style: solid;
        border-width: 1px;
        white-space:nowrap;
    }
     .subject-pill{ 
        width: 218px;
     }
    

    reference site : white space no wrap

    0 讨论(0)
提交回复
热议问题