Build a two-layer glow around a readable heading
Admin ·
Keep the fill of a display heading readable while you work on its shadows. This example puts two centered blue glows behind the same letters so you can change the order and opacity without changing the text itself.
Start with two centered glows
Choose Blue glow. The first layer has zero offset, a 4-pixel blur and color #c4edff. The second also has zero offset, with a 16-pixel blur and color #268bf4. The tight layer draws over the broader one.
Select Layer 1 and enter rgb(196 237 255 / 50%) as Shadow color. The CSS shows rgba(196, 237, 255, 0.5) for that layer. It uses the same blur radius and produces a softer highlight through transparency.
W3C CSS Text Decoration, text-shadowW3C CSS Color Level 4, transparency and color syntax
Move the wide glow to the front
Select Layer 2 and click Move layer up. The 16-pixel shadow becomes the first comma-separated entry. Compare the edges of the letters before and after the change.
To give the shadow a direction, change one X or Y offset. Negative Y moves it up. Set Blur to zero to inspect a crisp offset before you add softness.
Apply the CSS to the heading you will publish
Download text-shadow.css and give a heading the shadow-text class. Check the comma-separated order in the file. The generated rule includes text size, weight and color. Set the font family and surface background in your layout.
Check the text-to-background ratio before relying on glows. The preview composites transparent text over its background and reports that ratio before the shadows are drawn. Compare the rendered heading against its actual page surface at a small screen width.
W3C CSS Text Decoration, text-shadowW3C CSS Color Level 4, transparency and color syntax
Common questions
Which shadow values can I vary independently?
Each of the eight layers has its own horizontal and vertical offsets, blur and color. Enter alpha in the color value to set its opacity.
What does removing the last layer do?
The generated rule becomes text-shadow: none. The selected font size, weight and text color still apply.