6
votes

I have installed @fortawesome/angular-fontawesome - from here - https://www.npmjs.com/package/@fortawesome/angular-fontawesome into my Angular 7 application.

I can use the icon using but i cannot find a way to add them through CSS.

I am trying to add ico CSS Pseudo-elements like this:

.test:before {
    font-family: "Font Awesome 5 Free";
    content: "\f75b";
    display: inline-block;
    padding-right: 3px;
    vertical-align: middle;
    font-weight: 900;
 }

This is not working. All im seeing is a empty square. Anyone figured out how to use icons through CSS Pseudo-elements?

2

2 Answers

0
votes

I didn't found a way using the angular-font-awesome package to able use it with pseudo elements in css or .scss.

The only method that I found is this: [ Paste this next code in the top of your styles.css or styles.scss file ]

@font-face {
    font-family: 'FontAwesome';
    font-style: normal;
    font-weight: normal;
    src: url("http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/fonts/fontawesome-webfont.eot?v=4.3.0");
    src: url("http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/fonts/fontawesome-webfont.eot?#iefix&v=4.3.0") format("embedded-opentype"), url("http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/fonts/fontawesome-webfont.woff2?v=4.3.0") format("woff2"), url("http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/fonts/fontawesome-webfont.woff?v=4.3.0") format("woff"), url("http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/fonts/fontawesome-webfont.ttf?v=4.3.0") format("truetype"), url("http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular") format("svg");}

I know that I'm importing again font awesome, but I hope this unpractical method will help you.

-3
votes

Use font-family: "FontAwesome";