A comparison of two CSS techniques for fading text content using transparent gradients. The first uses `background-clip: text` combined with `color: transparent` and a gradient background, which is widely supported but strips custom text colors (links, emoji). The second uses `mask-image` with a gradient, which preserves individual text colors but fades selection highlights and requires the `-webkit-` prefix for Edge. Both techniques keep text selectable, unlike the overlay approach they improve upon. Browser support details and code examples are provided for each.

7m read timeFrom polypane.app
Post cover image
Table of contents
Technique one: background-clipTechnique two: mask-imageFading text content