Skip to content
CODE THE PIXEL
Misc

Using Font Awesome Icons in Website

Asyraf Wahi Anuar 2 min read

This tutorial will show the basic instruction on how to implement Font-Awesome 6 into the website.

This tutorial may be outdated

It was last reviewed 4 years ago. Some steps may differ in newer versions.

Using icons in web design is very useful in modernizing the website design and it also can visually explain a concept. There are many free and open-source web icons available eg: Font Awesome, Friconix, Flaticon, Fontello, Fork Awesome and even front-end frameworks like Bootstrap also have their Bootstrap Icons. This tutorial will list the steps to implement Font-Awesome Icon on the website. Generally, the step is almost the same for any web icon API.

The Icon Source: Font Awesome

Include the following Font Awesome 6 CDN inside <head> section. This CDN is provided by CDNJS.

HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg==" crossorigin="anonymous" referrerpolicy="no-referrer" />

Select and Apply Icon

Navigate to Font Awesome Icon Library and select any free icon that your want to apply.

HTML
<i class="fa-solid fa-cannabis"></i>

Each icon has two classes and uses the <i> tag. The first, "fa-solid," defines the element as a solid icon style (for example, solid, regular, light, thin, duotone), while the second, "fa-cannabis," identifies the exact symbol to load. Simply find the proper CSS class to utilise different icons.

Icon Size

To change the icon size, add fa-3x after the second class. It supports fa-1x until fa-10x

HTML
<i class="fa-solid fa-cannabis fa-3x "></i>

The above instruction is the basic method to include and use icons in a website. There are many other customizations available for Font Awesome on their official doc. You also need to subscribe to the Pro plan which offers more customization and icons. Enjoy your icons.

Did this tutorial help?

215 readers found this helpful

Comments

No comments yet. Questions about this tutorial are welcome here: the answer helps the next reader too.

Leave a comment

Markdown works: `code`, ``` blocks, **bold**, links.

First comments are reviewed before they appear.

Misc

Web scraping using PHP Simple HTML DOM Parser

This tutorial will explain how to use PHP Simple HTML DOM Parser to extract specific content from a website and publish it into another website. Web scraping is the process of extracting data or content from a website. The extracted data or content can be published on other websites or saved into a...

4 min read

Misc

Git Tutorial: Uploading a Project to GitHub and Collaborating with Others

Version control is essential for developers, and Git is a powerful tool that helps manage project changes efficiently. GitHub, a popular platform built on Git, not only hosts repositories but also facilitates collaboration among developers worldwide. In this tutorial, we will explore the process of...

4 min read