What CSS property creates a shadow effect on text?

The story behind the answer

The CSS property that creates a shadow effect on text is `text-shadow`.

It lets authors add one or more shadows behind or around the glyphs in an element. A typical declaration specifies horizontal offset, vertical offset, blur radius, and color, such as `text-shadow: 2px 2px 4px gray`. Multiple comma-separated shadows can create outlines, glows, or layered effects.

A common mix-up is `box-shadow`, which applies a shadow to an element’s rectangular box rather than to the shapes of its letters. The `drop-shadow()` filter function is another related tool, but it is a filter function used inside the `filter` property, not the dedicated text-shadow property. `text-shadow` follows the contours of the text itself and can therefore produce effects that differ from a box shadow.

Text shadows became popular as CSS reduced the need for image-based typography and decorative text graphics. They should be used with restraint: heavy shadows can reduce readability, while a subtle offset or glow can improve contrast against a busy background.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: