~/css/text-shadow-generator
CSS Text Shadow Generator
Add depth, glow or a crisp drop shadow to text. Set the offset, blur, colour and opacity, add an optional second glow layer for neon effects, and preview the result on a light or dark background before you copy the rule.
Neon nights
Using the CSS Text Shadow Generator
The text-shadow values
text-shadow takes a horizontal offset, a vertical offset, a blur radius and a colour. Unlike box-shadow there is no spread or inset. You can stack several shadows separated by commas; the first one is drawn on top.
Glow effects
A glow is a shadow with no offset and a large blur in a bright colour. Stacking two or three glows of increasing blur builds a convincing neon sign. The glow layer in this generator adds one such shadow on top of the drop shadow.
Readability first
A subtle shadow can lift light text off a busy photo, but heavy blur makes letters fuzzy and harder to read. For body text, keep shadows small or avoid them; save dramatic effects for big headlines.
Shadows as outlines
Four tight shadows offset by one pixel in each direction make a fake text outline, an old trick for readable captions over images. The native -webkit-text-stroke property is another option for headings.
Readable text over images
For captions over photos, a soft dark shadow with a small offset and moderate blur, such as 0 1px 3px at 60% opacity, lifts light text without looking heavy. For guaranteed contrast, combine it with a semi-transparent dark gradient behind the text, because a shadow alone cannot rescue text on a very bright image.
How do I make text readable over a photo?
A soft dark shadow such as 0 1px 3px rgba(0,0,0,0.6) separates light text from a busy image without looking like an effect. For large amounts of text, a semi-transparent overlay behind the text is more reliable than a shadow, because a shadow only helps the edges of each letter.
Worked example: a neon heading
Neon text uses several shadows with no offset: a small, bright blur close to the letters and a larger, softer blur in the same colour further out, on a dark background. Turn on the glow layer, set both colours to the text colour and increase the glow blur until the light spreads. Keep this for short headings; on paragraphs it makes reading tiring.
Frequently asked questions
Does text-shadow affect layout?
No. Shadows are painted outside the text without taking up space.
Is text-shadow expensive?
Static shadows are cheap. Animating large blurred text shadows on lots of text can be slow on phones.
Can I put a shadow on an icon font or SVG?
Icon fonts take text-shadow. For SVG, use filter: drop-shadow() from the CSS filter generator.
Can I add more than two shadows?
Yes. text-shadow accepts a comma-separated list, and the first shadow is drawn on top. Copy the rule and add more layers by hand if you need them.
Does text-shadow count towards contrast checks?
Contrast checks compare the text colour with the background, not the shadow. A shadow can improve real readability, but you should still choose text and background colours that meet contrast guidelines on their own.