How To Style Icon Color Size and Shadow BY USing Css

admin_img Posted By Bajarangi soft , Posted On 09-10-2020

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.

Icon color size

fontawesome link:
Note: No downloading or installation is required.

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

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="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

    <style>
        h1 {
            color: #b81fa3;
            text-shadow: 2px 3px 6px #de795f;
        }
        .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>BAJARANGI SOFT</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>
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=
            "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

    <!-- CSS style to set the icon -->
    <style>
        h1 {
            color: #26aae7;
            text-shadow: 2px 3px 6px #e36c1d;
        }
        .icons {
            color: #f37313;
            width: 500px;
            height: 200px;
            border: 5px solid #dc3d14;
        }
        i {
            text-shadow:2px 4px 6px #e8e416;
        }
        .fa {
            font-size:50px;
        }
        .fa-apple, .fa-car {
            font-size:80px;
        }
    </style>
</head>

<body style = "text-align:center;">

<div class = "icons">

    <h1>BAJARANGI SOFT</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 fa-spinner fa-pulse"></i>
    <i class="fa fa-bolt"></i>
    <i class="fa fa-apple"></i>
    <i class="fa fa-star fa-spin"></i>
</div>
</body>

</html>

Related Post