Javatpoint Logo
Javatpoint Logo

CSS Icons

Introduction

With the help of CSS icons, we can add icons to the HTML page from the icon library. All the icons available in the icon library can be formatted using the CSS properties. We can customize the icon based on size, color, shadow, etc. We can graphically represent the icons used in size, color, shadow, etc. There are three types of icons available on the internet. These are as follows.

  • Font Awesome Icons
  • Google Icons
  • Bootstrap Icons

We required the CDN link to make all the icons on the webpage. We can also customize the predefined icons with the help of CSS.

Approach

To use the icons first, we must link the CDN link inside the <head> tag. To achieve this, we have to follow the below steps.

  • First, we have to add the name of the icon of the class in the HTML element.
  • We can add the icons with the help of <i> and <span> elements.
  • Then, we need all the icons to be customized with the required CSS properties, such as size, color, shadow, etc.

Method 1: Font Awesome Icons

When there is a need for awesome icons, we must add the link below inside the <head> tag.

We must follow the syntax below when adding icons to the web page.

Syntax:

Example 1:

In the below example, we use the font property with each icon class & whose value is set to 32px.

Code:

Output:

CSS Icons

Example 2:

Output:

CSS Icons

Method 2: Google Icons

We can also insert the Google icons in our HTML web page. To do this, we have to insert the following code inside the head tag of our HTML code.

Syntax:

We must follow the syntax below to import the Google icon into our webpage.

Example 3:

In the below example, we will see the implementation of the "material-icons" class with the required icon.

Code:

Output:

CSS Icons

Example 4:

In the below code, we will see the implementation of the "material-icons" class with the cloud shape.

Code:

Output:

CSS Icons

Method 3: Bootstrap Icons

We must link the link inside the <head> tag to use the bootstrap icon.

Example 5:

In the below example, we have implemented the font-size property and all the glyph icon class & all the value is set to different numbers.

Code:

Output:

CSS Icons

Example 6:

In the below example, we have implemented the "glyph icon glyph icon-thumbs-up" class, which gives the output of the thumbs-up shape, and all the outputs have different shapes and numbers.

Code:

Output:

CSS Icons

Example 7:

The below program contains some of the icons in a single web page.

Output:

CSS Icons





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA