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

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.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>                           

chevron_right


Output:

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

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>                    

chevron_right


Output:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.