Skip to content

Instantly share code, notes, and snippets.

@frankyonnetti
Last active September 11, 2023 22:03
Show Gist options
  • Save frankyonnetti/9fa3dddb70dbab9bcf27 to your computer and use it in GitHub Desktop.
Save frankyonnetti/9fa3dddb70dbab9bcf27 to your computer and use it in GitHub Desktop.
#fonts #css use font-awesome in CSS (background image)
/* 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;
}
}
Copy link

ghost commented Jan 28, 2019

not working brother

@BrendonKoz
Copy link

BrendonKoz commented May 15, 2019

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