The most popular answer says that Font Awesome uses images. From what I understood, it does not use images in the normal case.
Let's do some experiments to dive into details.
I used the following minimal code to test Font Awesome.
You can try it yourself. Copy-paste it into a static HTML file and open the file in a browser.
<html lang="en">
<head>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css">
</head>
<body>
<i class="fas fa-desktop" ></i>
<i class="fas fa-desktop" style="color:red"></i>
<i class="fas fa-desktop" style="color:blue;font-style:italic"></i>
<i class="fas fa-desktop" style="color:green;font-style:italic;font-size:40px"></i>
</body>
</html>
As you can see, I have used a Font Awesome desktop icon with style applied on top of it using the simple style=""
attribute.
Here is the result..
It responds to everything that a font can respond to. It responds to color, It responds to italics, and it responds to font size.
So to me, it does not look like a static image. Maybe it is SVG?
Open Chrome network tab and refresh to load the static HTML file again.
I see only these calls:
There is one font file: fa-solid-900.woff2 (web open font format). Download this file just for the experiment and put it within the same folder as our experimental HTML file, we will refer to it in next experiment.
Let's create a new HTML file without refering to Font Awesome CSS and just using the font file:
<html lang="en">
<head>
<style>
@font-face {
font-family: "Font Awesome 5 Free";
font-style: normal;
font-weight: 900;
font-display: block;
src: url(fa-solid-900.woff2)
}
.my-custom-desktop-icon:before
{
font-weight: 900;
font-family: "Font Awesome 5 Free";
content: "\f108";
}
</style>
</head>
<body>
Custom Icon classes
<span class="my-custom-desktop-icon" ></span>
<i class="my-custom-desktop-icon" style="color:red"></i>
<i class="my-custom-desktop-icon" style="color:blue;font-style:italic"></i>
<i class="my-custom-desktop-icon" style="color:green;font-style:italic;font-size:40px"></i>
</body>
</html>
Result is the same:
I do not understand the full details of font creation yet. However, this is a high-level understanding. For each font icon class Font Awesome has specified a special font shape which it accesses by using a special character sequence. For desktop icon it is \f108
Font Awesome uses CSS classes with the selector :before
for linking each font shape with a class name. Like the following...
.my-custom-desktop-icon:before
{
font-weight: 900;
font-family: "Font Awesome 5 Free";
content: "\f108";
}
If we look at the Font Awesome CSS file there are references to many other src for a font but I think the browser loads the first compatible file only. So for most browsers, image files are not required.