0

I am trying to use font Awesome icon as Pseudo-Element with content property so that importing their whole library is not needed.

The output shows up a squared box instead of the actual icon . I think i am missing something here

<div>
<span class="icon"></span>Text After icon
</div>
.icon::before {
  display: inline-block;
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  content: "\f007";
  font-size: 30px;
}
Badal Singh
  • 479
  • 8
  • 24

1 Answers1

0

I've fixed your code by adding font awesome, please try this:

<div>
<span class="icon"></span>Text After icon
</div>
<link rel="stylesheet" 
href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" 
integrity="sha384- 
 B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" 
  crossorigin="anonymous">