A letter stencil over a dyed cloth: write the gradient text recipe, the browser paints its three layers and reads its own paint, and Mr. Harun’s old phone…
Gradient headings are on many landing pages. The recipe is short, but every line has a job: without a see-through fill the gradient does not show, with a block box its colours are wasted on empty space, and without @supports the heading can vanish in a browser that cannot clip to text.
Three layers: the background clipped to the letters, then the letters’ fill painted on top
color: transparent: solid text, no gradient The clip works, but the letters’ fill is painted over the background and hides it. Set color: transparent (or -webkit-text-fill-color: transparent) so the clipped background shows through.background-clip: text, unprefixed Chrome before version 120 (and older Chromium-based browsers) only know -webkit-background-clip: text. Write both: the -webkit- one first, then the standard one.color: <colour> before color: transparent in the same rule does not help: the last one always wins. Put a solid colour outside, and the gradient recipe (with color: transparent) inside @supports (background-clip: text) or (-webkit-background-clip: text).color: transparent The text turns solid. Layers 1 and 2 stay the same: only layer 3 changes, the fill that covers the gradient.color: transparent still wins although the clip does not work.