Font Awesome icon

Font Awesome is a popular icon font library used for web design and development.

Font Awesome contains a series of vector icons that can be easily called and used via CSS, and they can be customized in size, color, shadow, and more.

Font Awesome was originally an open-source project created by Dave Gandy, with the goal of providing a flexible, easy-to-use, and scalable icon set to replace traditional image icons.

Font Awesome has been updated through many versions, and the mainstream version currently isFont Awesome 6 、Font Awesome 5AndFont Awesome 4, all versions can be referenced at:https://fontawesome.com/versions。

This site's test usedFont Awesome 4, icon list:https://fontawesome.com/v4/icons/。

To use Font Awesome icons, in the HTML page's<head>add the following line(s) to the section:

1. Domestic recommended CDN:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

2. Overseas recommended CDN

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/font-awesome.min.css">

3. Download directly to local

Download

Note:It is not recommended to download and install it; simply reference the CDN file in the head of the HTML document.

Note:This tutorial uses version 4.7.0.

You can use the prefixfaPlace Font Awesome icons according to the icon names.

Example

<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> </head> <body> <i class="fa fa-car"></i> <i class="fa fa-car" style="font-size:48px;"></i> <i class="fa fa-car" style="font-size:60px;color:red;"></i> </body> </html>

Result:


Try it Yourself »

Click the "Try it" button to view online examples

Font Awesome is designed to be used with inline elements. The `<i>` and `<span>` elements are widely used for icons.

Also note that if you change the font size or color of the icon container, the icon will change accordingly.


Large icons

The fa-lg (increases by 33%), fa-2x, fa-3x, fa-4x, or fa-5x classes are used to increase icon size relative to their container.

Example

<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> </head> <body> <i class="fa fa-car fa-lg"></i> <i class="fa fa-car fa-2x"></i> <i class="fa fa-car fa-3x"></i> <i class="fa fa-car fa-4x"></i> <i class="fa fa-car fa-5x"></i> </body> </html>

Result:


Try it Yourself »

Tip: If your icons are cut off at the top and bottom, increase the line height.


List Icon

The `fa-ul` and `fa-li` classes are used to replace the default prefix in unordered lists.

Example

<ul class="fa-ul"> <li><i class="fa-li fa fa-check-square"></i>List icons</li> <li><i class="fa-li fa fa-spinner fa-spin"></i>List icons</li> <li><i class="fa-li fa fa-square"></i>List icons</li> </ul>

Result:

  • List icons
  • List icons
  • List icons

Try it Yourself »

Bordered and pulled icons

The fa-border, fa-pull-right, or fa-pull-left classes are used for pull quotes or article icons.

Example

<i class="fa fa-quote-left fa-3x fa-pull-left fa-border"></i>Rookie Tutorial -- Learning is not only technology, but also dreams!!!<br>Rookie Tutorial -- Learning is not only technology, but also dreams!!!<br>Rookie Tutorial -- Learning is not only technology, but also dreams!!!<br>Rookie Tutorial -- Learning is not only technology, but also dreams!!!

Result:

Rookie Tutorial -- Learning is not only technology, but also dreams!!!
Rookie Tutorial -- Learning is not only technology, but also dreams!!!
Rookie Tutorial -- Learning is not only technology, but also dreams!!!
Rookie Tutorial -- Learning is not only technology, but also dreams!!!

Try it Yourself »

Dynamic Icon

The `fa-spin` class makes the icon rotate, and the `fa-pulse` class makes the icon rotate in 8-step cycles.

Example

<i class="fa fa-spinner fa-spin"></i> <i class="fa fa-circle-o-notch fa-spin"></i> <i class="fa fa-refresh fa-spin"></i> <i class="fa fa-cog fa-spin"></i> <i class="fa fa-spinner fa-pulse"></i>

Result:


Try it Yourself »

Note:IE8 and IE9 do not support CSS3 animations.


Rotated and flipped icons

The fa-rotate-* and fa-flip-* classes are used to rotate and flip icons.

Example

<i class="fa fa-shield"></i> <i class="fa fa-shield fa-rotate-90"></i> <i class="fa fa-shield fa-rotate-180"></i> <i class="fa fa-shield fa-rotate-270"></i> <i class="fa fa-shield fa-flip-horizontal"></i> <i class="fa fa-shield fa-flip-vertical"></i>

Result:


Try it Yourself »

Stacked icons

To stack multiple icons, use the `fa-stack` class on the parent, the `fa-stack-1x` class for icons of regular size, and `fa-stack-2x` for larger icons.

The `fa-inverse` class can be used as an alternative icon color. You can also add larger icon classes to the parent to further control size.

Example

<span class="fa-stack fa-lg"> <i class="fa fa-circle-thin fa-stack-2x"></i> <i class="fa fa-twitter fa-stack-1x"></i> </span> fa-twitter on fa-circle-thin<br> <span class="fa-stack fa-lg"> <i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-twitter fa-stack-1x fa-inverse"></i> </span> fa-twitter (inverse) on fa-circle<br> <span class="fa-stack fa-lg"> <i class="fa fa-camera fa-stack-1x"></i> <i class="fa fa-ban fa-stack-2x text-danger" style="color:red;"></i> </span> fa-ban on fa-camera

Result:

fa-twitter on fa-circle-thin
fa-twitter (inverse) on fa-circle
fa-ban on fa-camera

Try it Yourself »

Fixed-width icons

The `fa-fw` class is used to set fixed-width icons. This class is very useful when different icon widths cause misalignment. It is especially suitable for Bootstrap's nav lists and list groups.

Example

<div class="list-group"> <a href="#" class="list-group-item"><i class="fa fa-home fa-fw"></i> Home</a> <a href="#" class="list-group-item"><i class="fa fa-book fa-fw"></i> Library</a> <a href="#" class="list-group-item"><i class="fa fa-pencil fa-fw"></i> Applications</a> <a href="#" class="list-group-item"><i class="fa fa-cog fa-fw"></i> Settings</a> </div>

Try it Yourself »
other extensions