GUIDE深度 · Deep dive

Text Readability on Gradients

Luminance varies across a gradient, so text may fail in one region. Add an overlay/solid layer to raise local contrast, or place text where the gradient is darkest or lightest.

更新 2026-10-31 · 公式可核验

Techniques

Add a semi-transparent black or white overlay under text.

Use text-shadow or a stroke to raise edge contrast.

Put key text on a solid area.

Testing

Test at both the lightest and darkest parts.

Check mobile and dark mode.

FAQ

Does an overlay change brand colors?

Yes; use low opacity or a local overlay to limit the change.

What about gradient buttons?

Test text contrast plus hover and focus states.

Sources

Related calculators

CSS Gradient GeneratorPick two colors and an angle, preview live and copy the CSS gradient code.

More guides

CSS Gradients BasicsRead guide