Frontend.fyi

Recipe

Using CSS masks to fadeout content

Now you see me, now you don't

Go Pro

Playgrounds are part of PRO

Frontend.fyi Playgrounds let you take any code example and turn it into a live, editable sandbox — so you can tweak the code, build on it, and learn by doing.

This feature is part of Frontend.fyi PRO, which gives you lifetime access to:

  • Interactive playgrounds (like this one)
  • Full courses (Framer Motion, CSS, and more coming)
  • Copy-paste UI recipes with video walkthroughs
  • Your own public profile to showcase projects and experiments (soon!)

If you're ready to go beyond just watching tutorials and actually build things yourself, PRO is for you.

Combining a linear gradient with a mask image in CSS, results in nice fadeout masks that you can add on top of any element you want.

These masks have a configurable CSS variable --fade-size that you can adjust to make the fadeout effect hide more or less of the content, without changing the class itself.