Tutorialspoint.dev

CSS | Icons

Icons can be added to our HTML page with icon library. All the icons in the library can be formatted using CSS. They can be customized according to size, color, shadow, etc.
Types of icon library:

  • Font Awesome Icons
  • Google Icons
  • Bootstrap Icons

Note: All the above-mentioned library does not require any downloading or installation.

Font Awesome Icons: To use Font Awesome Icons add the following link inside <head> section.



Example 1:

<!DOCTYPE>
<html>
   <head>
      <link rel="stylesheet" 
   </head>
   <body>
      <h1>
         GEEKSFORGEEKS
      </h1>
      <i class="fa fa-cloud" style="font-size:32px;"></i>
      <i class="fa fa-heart" style="font-size:32px;"></i>
      <i class="fa fa-file" style="font-size:32px;"></i>
      <i class="fa fa-car" style="font-size:32px;"></i>
      <i class="fa fa-bars" style="font-size:32px;"></i>
   </body>
</html>

Output:


Example 2:

<!DOCTYPE>
<html>
   <head>
      <link rel="stylesheet" 
   </head>
   <body>
      <h1>
         GEEKSFORGEEKS
      </h1>
      <i class="fa fa-heart" style="font-size:28px;color:red;"></i>
      <i class="fa fa-heart" style="font-size:30px;color:blue;"></i>
      <i class="fa fa-heart" style="font-size:32px;color:red;"></i>
      <i class="fa fa-heart" style="font-size:34px;color:blue;"></i>
      <i class="fa fa-heart" style="font-size:36px;color:red;"></i>
   </body>
</html>

Output:




Google Icons: To use Google Icons add the following link inside <head> section.

<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

Example 1:

<!DOCTYPE>
<html>
   <head>
      <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
   </head>
   <body>
      <h1>
         GEEKSFORGEEKS
      </h1>
      <i class="material-icons">cloud</i>
      <i class="material-icons">favorite</i>
      <i class="material-icons">attachment</i>
      <i class="material-icons">computer</i>
      <i class="material-icons">traffic</i>
   </body>
</html>

Output:


Example 2:

<!DOCTYPE>
<html>
   <head>
      <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
   </head>
   <body>
      <h1>
         GEEKSFORGEEKS
      </h1>
      <i class="material-icons"style="font-size:30px;">cloud</i>
      <i class="material-icons"style="font-size:40px;">cloud</i>
      <i class="material-icons"style="font-size:50px;">cloud</i>
      <i class="material-icons"style="font-size:60px;">cloud</i>
      <i class="material-icons"style="font-size:70px;">cloud</i>
   </body>
</html>

Output:

google-icon

Bootstrap Icons: To use Bootstrap Icons add the following link inside <head> section.

Example 1:

<!DOCTYPE>
<html>
   <link rel="stylesheet" 
   </head>
   <body>
      <h1>
         GEEKSFORGEEKS
      </h1>
      <i class="glyphicon glyphicon-cloud"style="font-size:28px;"></i>
      <i class="glyphicon glyphicon-user"style="font-size:30px;"></i>
      <i class="glyphicon glyphicon-thumbs-up"style="font-size:32px;"></i>
      <i class="glyphicon glyphicon-remove"style="font-size:34px;"></i>
      <i class="glyphicon glyphicon-envelope"style="font-size:36px;"></i>
   </body>
</html>

Output:


Example 2:

<!DOCTYPE>
<html>
   <link rel="stylesheet" 
   </head>
   <body>
      <h1>
         GEEKSFORGEEKS
      </h1>
      <i class="glyphicon glyphicon-thumbs-up"style="font-size:20px;"></i>
      <i class="glyphicon glyphicon-thumbs-up"style="font-size:30px;"></i>
      <i class="glyphicon glyphicon-thumbs-up"style="font-size:40px;"></i>
      <i class="glyphicon glyphicon-thumbs-up"style="font-size:50px;"></i>
      <i class="glyphicon glyphicon-thumbs-up"style="font-size:60px;"></i>
   </body>
</html>

Output:

bootstrap-icon



This article is attributed to GeeksforGeeks.org

leave a comment

code

0 Comments

load comments

Subscribe to Our Newsletter