A Major problem I found while developing with Bootstrap 4 and trying to create a Font Awesome button that when I create a series of buttons, I get different size buttons, the only way to get the same size buttons is to use the same font for each one So the problem is due to Font Awesome sizes is not the same for every one.
<a class="btn btn-outline-warning" type="button" href="#">
<i class="fa fa-edit"></i>
</a>
<a class="btn btn-outline-danger" type="button" href="#">
<i class="fa fa-trash"></i>
</a>
Does one have a practical exemple to get Off this problem ?
For single-input forms in bootstrap 4, a nice way to place font-awesome icons is the input-group-addon class: <div class="input-group"> <span class="input-group-addon"> <i Stack Overflow About Products For Teams Stack OverflowPublic questions & answers
Bootstrap 4 does not have its own icon library ( Glyphicons from Bootstrap 3 are not supported in BS4). However, there are many free icon libraries to choose from, such as Font Awesome and Google Material Design Icons.
Bootstrap 4 Icons. Bootstrap 4 does not have its own icon library (Glyphicons from Bootstrap 3 are not supported in BS4). However, there are many free icon libraries to choose from, such as Font Awesome and Google Material Design Icons. To use Font Awesome icons, add the following to your HTML page (No downloading or installation is required):
Note: No downloading or installation is required! You place Font Awesome icons by using the prefix fa and the icon's name.
While you can certainly manually adjust the font size of your Font Awesome icons, I would suggest a less dramatic approach: .fa-fw
. This is a utility class that is part of Font Awesome's stylesheet that helps unify the width of your fonts. Per the 4.7.0 documentation:
Use
fa-fw
to set icons at a fixed width. Great to use when different icon widths throw off alignment. Especially useful in things like nav lists & list groups.
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<a class="btn btn-outline-warning" href="#">
<i class="fa fa-fw fa-edit"></i>
</a>
<br>
<a class="btn btn-outline-danger" href="#">
<i class="fa fa-fw fa-trash"></i>
</a>
<br>
<a class="btn btn-outline-success" href="#">
<i class="fa fa-fw fa-wrench"></i>
</a>
<br>
<a class="btn btn-outline-info" href="#">
<i class="fa fa-fw fa-stop"></i>
</a>
In the above example you can see how .fa-fw
has adjusted your icon spacing and everything looks the same. You might notice though that I did also remove type="button"
from your anchor tag as this was resulting in Bootstrap not applying the full CSS of the ban-outline-*
you were declaring.
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