Home > Back-end >  Using icon in css files by pseudo element
Using icon in css files by pseudo element

Time:10-27

How I Can Use Icons From "Font Awesome" As Pseudo Element As "After Or Before"
I Try Do This A lot but It didn't work

CodePudding user response:

You can add icons using Font Awesome Cheat Sheet. https://fontawesome.com/v4.7/cheatsheet/

Here is an example how you can do that.

.icon
{
content: '\'
font: normal normal normal 14px/1 FontAwesome;
font-size: 16px;
}

CodePudding user response:

a:before {
   font-family: FontAwesome;
   content: "\f095";
   display: inline-block;
   padding-right: 3px;
   vertical-align: middle;
}
<!DOCTYPE html>
<html>
<head>
<title>Font Awesome Icons</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>

<a href="#">Call Us</a>

</body>
</html> 
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  •  Tags:  
  • css
  • Related