Font Awesome Icons [ Icons ] - CSS Bundle
Font Awesome Icons
I have been using this awesome font library for so long now that i almos overlooked it as being such a stable web developer resource for an amazing set of icons and easy to add to your project.
What is Font Awesome?
Its a library of SVG icons that you can add to your site with one include and then the use of the i tags, with a whole library of icons you can choose from.
Preview
a preview of Font Awesome Icons
How do i use Font Awesome.
- Include this script tag in your site
<head>
:<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css" />
- Usually you can just go to cdnjs.com to grab the latest version of font awesome include.
- Pick the icon you want to display from here.
[1] - Paste that code in your page
<body>
.
Should I use it?
They seem to be making the latest versions of it quite complicated to install with the creation of a kit, im not sure why this would be benificial, i think you maybe able to choose the icon sets that you want to use rather than just loading all icons by default. But just using the basic include seems to be quite good still.
It still is probably better to just source your own SVG icons and include them manually even though this is a bit more work initially.
File Sizes for Font Awesome
It seems this library consumes a lot of resources.
The Min css file alone is 101kb.
File | Size |
all.min.css | 101 kb |
fa-solid-900.woff2 | 75 kb |
fa-regular-400.woff2 | 14.3 kb |
fa-brands-400.woff2 | 106 kb |
296.3 kb |
So the total additional added, even if just using one of the icons is almost 300kb (296.3kb) which seems like a lot for one icon.
If you are using a large amount of the icons then this might be worth it, but it still does seem a bit of a waste of space considering the small size of the singular svg files.
Extract singular icons
Rather than including 300kb of scripts, you can just extract the icons you want to use from the open source repo here.
https://github.com/FortAwesome/Font-Awesome/tree/master/svgs[2]
Just browse through the icons here, or use the icons finder and then extract them using the same name.
For our example icon, the souce of the SVG is only 500 bites. So its tiny. We include 300kb just for the convenience of ease in development, just to embed a 500 bite icon.
https://github.com/FortAwesome/Font-Awesome/blob/master/svgs/brands/css3-alt.svg[3]
HTML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M0 32l34.9 395.8L192 480l157.1-52.2L384 32H0zm313.1 80l-4.8 47.3L193 208.6l-.3.1h111.5l-12.8 146.6-98.2 28.7-98.8-29.2-6.4-73.9h48.9l3.2 38.3 52.6 13.3 54.7-15.4 3.7-61.6-166.3-.5v-.1l-.2.1-3.6-46.3L193.1 162l6.5-2.7H76.7L70.9 112h242.2z"/></svg>
Conclusion
The amazing library of icons that Font Awesome has and the ease of installation makes using the icons very easy, I think that the size of the included css might be large. So even while making it easier to install it may increase the size of your project.
Original Source
Font Awesome Icons Demo
View Demo Full Screen [5] View Demo New Tab [6]
Font Awesome Icons Code
HTML
<h2>Icon with 296kb of scripts</h2> <p>This icon uses the full font awesome css and library to display it loading 296kb of scripts. </p> <i class="fa-brands fa-css3-alt fa-4x"></i> <h2>Icon with no scripts</h2> <p>This version of the same icon is only 500 bytes, a saving of 295.5kb!</p> <svg class="css-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M0 32l34.9 395.8L192 480l157.1-52.2L384 32H0zm313.1 80l-4.8 47.3L193 208.6l-.3.1h111.5l-12.8 146.6-98.2 28.7-98.8-29.2-6.4-73.9h48.9l3.2 38.3 52.6 13.3 54.7-15.4 3.7-61.6-166.3-.5v-.1l-.2.1-3.6-46.3L193.1 162l6.5-2.7H76.7L70.9 112h242.2z"/></svg>
CSS
.css-svg { height:100px; width:100px; fill:orange; }
Scripts
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css" />
References
- ^ from here (fontawesome.com)
- ^ https://github.com/FortAwesome/Font-Awesome/tree/master/svgs (github.com)
- ^ https://github.com/FortAwesome/Font-Awesome/blob/master/svgs/brands/css3-alt.svg (github.com)
- ^ Font Awesome on Github (github.com)
- ^ View Demo Full Screen
- ^ View Demo New Tab