Open In App

How to style icon color, size, and shadow by using CSS ?

Improve
Improve
Like Article
Like
Save
Share
Report

The <i> tag and <span> tag are used widely to add icons on the webpages. To add any icons on the webpages, it need the fontawesome link inside the head tag. The fontawesome icon can be placed by using the fa prefix before the icon’s name.

fontawesome link:

https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css

Note: No downloading or installation is required.

Example 1: This example set the size, color and shadow of icon using CSS.




<!DOCTYPE html>
<html>
      
<head>
    <title>Font Awesome Icons</title>
  
    <link rel="stylesheet" href=
      
    <style>
        h1 {
            color: Green;
            text-shadow: 2px 3px 6px lime;
        }
        .icons {
            color: red;
        }
        i {
            text-shadow: 2px 4px 6px orange;
        }
        .fa{
            font-size: 50px;
        }
    </style>
</head>
  
<body style = "text-align:center;">
  
    <div class = "icons">
          
        <h1>GeeksforGeeks</h1>
          
        <i class="fa fa-cloud"></i>
        <i class="fa fa-car"></i>
        <i class="fa fa-road"></i>
        <i class="fa fa-fire"></i>
        <i class="fa fa-bolt"></i>
        <i class="fa fa-apple"></i>
        <i class="fa fa-ambulance"></i>
    </div>
</body>
  
</html>                           


Output:

Example:2 This example makes the icons spin and pulse by using fa-spin after the name of the icon.




<!DOCTYPE html>
<html>
      
<head>
    <title>Font Awesome Icons</title>
      
    <link rel="stylesheet" href=
      
    <!-- CSS style to set the icon -->
    <style>
        h1 {
            color: Green;
            text-shadow: 2px 3px 6px lime;
        }
        .icons {
            color: green;
            width: 500px;
            height: 200px;
            border: 5px solid green;
        }
        i {
            text-shadow:2px 4px 6px cyan;
        }
        .fa {
            font-size:50px;
        }
        .fa-apple, .fa-car {
            font-size:80px;
        }
    </style>
</head>
  
<body style = "text-align:center;">
  
    <div class = "icons">
      
        <h1>GeeksforGeeks</h1>
          
        <i class="fa fa-spinner fa-pulse"></i>
        <i class="fa fa-car"></i>
        <i class="fa fa-road"></i>
        <i class="fa fa-fire"></i>
        <i class="fa fa-bolt"></i>
        <i class="fa fa-apple"></i>
        <i class="fa fa-star fa-spin"></i>
    </div>
</body>
  
</html>                    


Output:



Last Updated : 11 Feb, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads