You can place Font Awesome icons just about anywhere using a style prefix and the icon's name. We've tried to make it so that icons take on the characteristics and appear alongside text naturally.
Font Awesome is designed to be used with inline elements, and we recommend sticking with a consistent HTML element to reference them by in your project. We like the <i> tag for brevity and because most folks use <em></em> for emphasized/italicized semantic text these days. If that's not your cup of tea, using a <span> is more semantically correct.
To reference an icon, you need to know two bits of information. **1) its name, prefixed with fa- (meaning “font awesome” naturally!) and 2) the style you want to use's corresponding prefix.
<!-- this icon's 1) style prefix == fas and 2) icon name == camera --><iclass="fas fa-camera"></i><!-- using an <i> element to reference the icon --><iclass="fas fa-camera"></i><!-- using a <span> element to reference the icon --><spanclass="fas fa-camera"></span>
The fa prefix has been deprecated in version 5. The new default is the fas solid style and the fab style for brands.
Since Font Awesome was first implemented and continues to support being rendered using the CSS @font-face method, each of its styles corresponds to a particular font weight:
While using an <i> or other HTML element is the most popular and easy way to render an icon, we do have advanced ways of using custom written CSS pseudo-elements if you prefer to have extra markup. Font weights are used with that technique and are how you would set the icon's style.
Ligature use in Font Awesome on the web
While our desktop workflow takes advantage of ligatures to make inserting icons into your favorite design and presentation apps easy. As well as our SVG + JS framework, ligature lookup tables take up additional file space and can cause performance issues. Until we have options and solutions for subsetting icons, we aren't comfortable considering ligatures for Web Fonts + CSS.
Font Awesome Icons + Your Project's Styling
Advertisement
Remove ads with a Pro plan!
A subscription to a Pro-level plan will remove all third-party advertisements on fontawesome.com.
And of course Pro-level plans come with…
All 7,864 icons in Font Awesome
5 Classic styles of every icon
4 Sharp styles of every icon
A Perpetual License to use Pro
Services and tools to make easy work of using icons
Font Awesome icons automatically inherit CSS size and color (as seen in the examples below). This means they blend in with text inline wherever you put them. Font Awesome tries not to be too opinionated, and sets just the basic styling rules icons needed to render properly in context.
While the basic way to reference an icon is simple and hopefully straight-forward, we've provided support-level styling for things like sizing icons, aligning and listing icons, as well as rotating and transforming icons.
You can also add your own custom styling to Font Awesome icons by adding your own CSS rules in your project's code. Everything you can normally control with CSS is up for grabs - from color to display to alignment.
We recommend targeting icons in your CSS in couple of different ways.
Styling Case
Recommended Selector
Custom styling all icons
Add a consistent custom class to all icons (e.g. .icon, .[projectprefix]-icon, or .fa-icon)
You can also use style classes that match your in-use icon styles .fas { ... } .far { ... } .fal { ... } .fad { ... } .fab { ... }
Custom styling a specific icon
Use the individual icon name, prefixed with .fa-
.fa-user { ... } .fa-font-awesome { ... }
Here's a quick example of using those selectors to add custom color to Font Awesome icons:
<head><!-- reference your copy Font Awesome here (from our CDN or by hosting yourself) --><linkhref="/your-path-to-fontawesome/css/fontawesome.css"rel="stylesheet"><linkhref="/your-path-to-fontawesome/css/brands.css"rel="stylesheet"><linkhref="/your-path-to-fontawesome/css/solid.css"rel="stylesheet"><styletype="text/css"><!-- custom styling for all icons -->
i.fas,
i.fab{border: 1px solid red;}<!-- custom styling for specific icons -->
.fa-fish{color: salmon;}.fa-frog{color: green;}.fa-user-ninja.vanished{opacity: 0.0;}.fa-facebook{color:rgb(59, 91, 152);}</style></head><body><iclass="fas fa-fish"></i><iclass="fas fa-frog"></i><iclass="fas fa-user-ninja vanished"></i><iclass="fab fa-facebook"></i></body>
When using our SVG framework, remember that Font Awesome-based <i> DOM elements are replaced with new <svg> elements by default. Be sure that your css rules target the right elements.