I am trying to change the contents spanusing the Font Awesome icon right from the CSS page, but cannot make it work properly.
1) I imported FA from the documentation and into <head>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.9/css/all.css" integrity="sha384-5SOiIsAziJl6AWe0HWRKTXlfcSHKmYV4RBF18PPJ173Kzn7jzMyFuTtk8JA7QQG1" crossorigin="anonymous">
2) My HTML looks like this:
<span class='myClass'>Movies</span>
3) Let's now say that I would like to change the contents of the range with the icon right from the CSS page.
My CSS currently looks like this, but it doesn't work, it gives me a square instead of an icon.
.myClass {
visibility: hidden;
}
.myClass::after {
font-family: 'Font Awesome 5 Free';
content: '\f008';
visibility: visible;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.9/css/all.css">
<span class='myClass'>Movies</span>
Run codeHide resultThe funny thing is that it looks like it works with some icons. If I test with content: '\f007';it works. Any ideas why?
(And if you're wondering why I want to change the icon directly in CSS, this is because I use media queries, so I canβt add it directly to the HTML page)