I'm trying to add FontAwesome icons to css pseudo elements
If I add the icon using html in the regular way it does work, but I'm trying to add the fonts to a bootstrap accordion so the icon changes in the collapsed state. That part works, but the icon is not showing. Instead there is a empty square in chrome and a square with the hex code in firefox.
Added kit (tried before and after css is loaded):
<script src="https://kit.fontawesome.com/30fc0982d8.js"></script>
CSS code:
#faq a:after{
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
font-family: 'Font Awesome 5 Free';
font-weight: 900;
content: '\f107';
}
#faq a.collapsed:after{
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
font-family: 'Font Awesome 5 Free';
font-weight: 900;
content: '\f106';
}
I would expect the icon to just show, but it doesn't. Any thoughts?
Edit: Forgot to add, I did some extensive searching on this and found several posts. Typically the solution was to add font-weight: 900
, but as you can see I already did that.
Edit2: This question was marked duplicate but for FontAwesome with JS+SVG. I'm using the webfonts option.