Last active
September 11, 2023 22:03
-
-
Save frankyonnetti/9fa3dddb70dbab9bcf27 to your computer and use it in GitHub Desktop.
#fonts #css use font-awesome in CSS (background image)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* v4 */ | |
.mytextwithicon { | |
padding-left: 15px; | |
position: relative; | |
&::before { | |
font-family: FontAwesome; | |
content: '\f069'; | |
position: absolute; | |
top: 0; | |
left: 0; | |
} | |
} | |
/* v5 */ | |
.mytextwithicon { | |
position: relative; | |
padding-left: 18px; | |
&::before { | |
content: "\f4fb"; | |
font-weight: 400; | |
font-family: "Font Awesome 5 Pro"; | |
position: absolute; | |
top: -1px; | |
left: 0; | |
} | |
} | |
/* v6 */ | |
.mytextwithicon { | |
position: relative; | |
padding-left: 18px; | |
&::before { | |
content: "\f56d"; | |
font: var(--fa-font-regular); | |
position: absolute; | |
top: 0; | |
left: 0; | |
} | |
} |
It works with FontAwesome 4. Still trying to figure out why it's not working with FontAwesome 5 (as a font, not SVG, which is quite different).
There are docs for FontAwesome 5. Figures.
https://fontawesome.com/how-to-use/on-the-web/advanced/css-pseudo-elements
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not working brother