Achieve Glow Effect with CSS Filters

The CSS glow effect is a visual technique used to create a luminous halo around elements. This effect makes objects appear to emit light and can be achieved using the drop-shadow filter or box-shadow properties.

Syntax

/* Using drop-shadow filter */
selector {
    filter: drop-shadow(0 0 blur-radius color);
}

/* Using box-shadow */
selector {
    box-shadow: 0 0 blur-radius color;
}

Parameters

Parameter Description
blur-radius The amount of blur for the glow effect (in px)
color The color of the glow (hex, rgb, or named colors)
spread-radius Optional: How much the glow expands (box-shadow only)

Example 1: Text Glow Effect

This example creates a glowing text effect using the text-shadow property −

<!DOCTYPE html>
<html>
<head>
<style>
    .glow-text {
        font-size: 3em;
        font-family: Arial, sans-serif;
        color: #ffffff;
        text-align: center;
        background-color: #333;
        padding: 50px;
        text-shadow: 0 0 20px #00ff00, 0 0 30px #00ff00, 0 0 40px #00ff00;
    }
</style>
</head>
<body>
    <div class="glow-text">CSS GLOW</div>
</body>
</html>
Large white text "CSS GLOW" with a bright green glow effect on a dark background.

Example 2: Image Glow with Filter

This example applies a glow effect to an image using the drop-shadow filter −

<!DOCTYPE html>
<html>
<head>
<style>
    .glow-image {
        width: 200px;
        height: 200px;
        background-color: #ff6b6b;
        border-radius: 50%;
        margin: 50px auto;
        filter: drop-shadow(0 0 25px #ff6b6b);
    }
    
    body {
        background-color: #222;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        margin: 0;
    }
</style>
</head>
<body>
    <div class="glow-image"></div>
</body>
</html>
A red circular element with a matching red glow effect around it on a dark background.

Example 3: Box Glow Effect

This example creates a glowing box using box-shadow with multiple shadows −

<!DOCTYPE html>
<html>
<head>
<style>
    .glow-box {
        width: 250px;
        height: 100px;
        background-color: #4a90e2;
        margin: 50px auto;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.2em;
        box-shadow: 
            0 0 10px #4a90e2,
            0 0 20px #4a90e2,
            0 0 30px #4a90e2,
            0 0 40px #4a90e2;
    }
    
    body {
        background-color: #1a1a1a;
        padding: 50px;
    }
</style>
</head>
<body>
    <div class="glow-box">Glowing Box</div>
</body>
</html>
A blue rounded rectangle with white text "Glowing Box" surrounded by an intense blue glow effect.

Conclusion

CSS glow effects can be achieved using text-shadow, box-shadow, or filter: drop-shadow(). Multiple shadows with increasing blur values create more realistic and intense glow effects.

Updated on: 2026-03-15T11:31:52+05:30

966 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements