Mr. Harun’s banner over a batik cloth: write a text-shadow list, the browser reads it back layer by layer, try what a fourth value does, and the letters’…
Why it matters
Headings over photos, neon, 3D or edge effects: all text-shadow, no images. What often goes wrong: writing a fourth value like box-shadow’s (the whole shadow disappears), and relying on a shadow for readability when the colour contrast is too low.
The key idea
text-shadow = copies of the letters, stacked from the back, no spread
Common mistakes
The fourth value was meant as spread, and the shadow vanishedtext-shadow is only x y blur colour: no spread and no inset (those are box-shadow’s). A fourth length makes the value invalid, so the whole declaration is dropped. For a thicker shadow, stack several layers.
A text edge with gaps from a single shadow One shadow shifts a copy of the letters one way only, so only two sides are covered. Use four sharp layers in the four diagonal directions (±1px), or -webkit-text-stroke for a true outline.
Text is still hard to read even with a shadow Contrast is measured between the letters’ colour and the colour behind them, over every part of the background; a thin or blurred shadow does not count (only a thick, dense halo may be taken as the background). Over a motif or a photo, put a semi-opaque band behind the text, or change its colour.
Try it in this playground
Tap one layer’s preview The banner shows that layer alone (with transparent letters): you see which copy of the letters it draws.
Add a layer, then move its x The list becomes two comma-separated parts; each part has its own x, y, blur and colour.
Type a fourth value, such as 0 0 4px 2px #000 The browser drops the whole text-shadow: the layer list is empty.
Move the last layer up Order matters: an earlier layer is painted over a later one.