0
<th>Cars <i class="fa fa-sort-asc pull-right"></i></th>

When I am using bootstrap's pull-right class, it aligns the icon in my th to the top right corner, and removing pull-right aligns the icon centered vertically to the left, but is there a way so that when I use pull-right it's aligned in the center vertically to the right?

I am using bootstrap and icons from fontawesome

amphetamachine
  • 27,620
  • 12
  • 60
  • 72

2 Answers2

5

You can use pull-left on the span instead..

<th class="text-right">
     <span class="pull-left">First Name</span>
     <i class="fa fa-sort-asc"></i>
</th>

http://codeply.com/go/DIWtVsyMwh

In Bootstrap 4, pull-left is now float-left, and pull-right is now float-right

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
0

You could have the icon on the right and vertically aligned with the text like this:

HTML

<th>
  <div class="header-with-icon">
    <div>First Name</div>
    <div class="text-right"><i class="fa fa-sort-asc"></i></div>
  </div>
</th>

CSS

.header-with-icon{
  display: table;
  width: 100%;
}

.header-with-icon > div{
  display: table-cell;
}

Here's a bootply example: http://www.bootply.com/Df5JpMyU2k

ChaoticNadirs
  • 2,280
  • 2
  • 20
  • 27