How to align bootstrap icon and image to bottom? ( I am using font-awsome for icons ).
JSBIN: http://jsbin.com/uwupuz/2/edit
<div class="btn-group">
<a class="btn" href="#">
<i class="icon-plus"></i>
<span>Add</span>
</a>
<a class="btn" href="#">
<i class="icon-trash"></i>
<span>Remove</span>
</a>
<a class="btn" href="#">
<i class="icon-edit"></i>
<span>Edit</span>
</a>
</div>
If you want to make a text appear vertically aligned next to a Font Awesome icon, you can use the CSS vertical-align property set to “middle” and also, specify the line-height property. Change the size of the icon with the font-size property.
Put the font awesome icon into a separate div and apply "text-center" class. It will align font-awesome icons to center.
We can align the buttons horizontally as well as vertically. We can center the button by using the following methods: text-align: center - By setting the value of text-align property of parent div tag to the center. margin: auto - By setting the value of margin property to auto.
Answer: Use the text-right Class You can simply use the class . text-right on the containing element to right align your Bootstrap buttons within a block box or grid column. It will work in both Bootstrap 3 and 4 versions.
Try this: http://jsfiddle.net/jonschlinkert/CBss2/1/ this is what it looks like after applying line-height: 1;
I wouldn't mess with the position
property as suggested by @hajpoj, there are cleaner ways to fix the problem that won't have cascading effects later. The other problem with using position: relative
is that each icon is actually a little bit different in size. You want to try to keep maintenance down by accounting for that. It's best to make it appear as if it's bottom-aligned for most normal sized icons, and when a larger-than-average icon is used it is centered properly with the text. Using position: relative
a larger icon will push above the others and look off-center.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With