I was trying to add the github (class="fas fa-github"
) icon on a bootstrap dark button, but the button icon and text doesn't appear (the console shows nothing)
Code:
<div class="jumbotron">
<h1 class="display-4">Henrique Borges</h1>
<p class="lead">Programador experiente e Web Designer.</p>
<hr class="my-4">
<p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
<p class="lead">
<a class="fas fa-github btn btn-dark btn-lg" href="#" role="button">Github</a>
</p>
</div>
I´ve already included both the BS and FA libraries:
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/fontawesome-all.min.js"></script>
Make sure you're using the latest and greatest by updating your CDN code reference, updating your Font Awesome package via npm, or downloading a fresh copy of Font Awesome. You can check with version an icon was added to on its detail page (e.g. question-circle was added in Verion 1 but last updated in 5.0. 0).
To use the Free Font Awesome 5 icons, you can choose to download the Font Awesome library, or you can sign up for an account at Font Awesome, and get a code (called KIT CODE) to use when you add Font Awesome to your web page.
Font Awesome 5 breaks backwards compatibility with Font Awesome 4 by changing both the prefixes and the names of certain icon classes. UberMenu 3.4 updates to Font Awesome 5. Therefore customers who have previously set Font Awesome 4 icons will have saved classes that are no longer Font Awesome 5-compatible.
I have run into this problem before, particularly with the fas
class. For me it has always been manually upgrading my font awesome style sheet tag in my head.
For whatever reason, dependency managers like yarn don't always have the very latest version of font awesome.
https://fontawesome.com/how-to-use/on-the-web/setup/getting-started?using=web-fonts-with-css
<!-- FontAwesome -->
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"
integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
Try the snippet. Changed the fas fa-github
to fab fa-github
.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="https://use.fontawesome.com/releases/v5.0.4/css/all.css" rel="stylesheet">
<div class="jumbotron">
<h1 class="display-4">Henrique Borges</h1>
<p class="lead">Programador experiente e Web Designer.</p>
<hr class="my-4">
<p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
<p class="lead">
<i class="fab fa-github btn btn-dark btn-lg" href="#" role="button"> Github</i>
</p>
</div>
.fas
class will only work with font-weight: 900
. make sure you have font-weight: 900
.
you are using multiple classes fas fa-github btn btn-dark btn-lg
if any of these does not have font-weight: 900
font will not show up.
try this
.btn {
font-weight: 900;
}
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