Menu

CSS mask-image Explained: Fade Edges Without Gradient Divs
๐Ÿ“ฐ

CSS mask-image Explained: Fade Edges Without Gradient Divs

DEV Community: cssยทParsa Jยทabout 8 hours ago
#UtilkJGm
#devtocss#devto#dev#gradient#fade
Long article (1181 words) โ€” no AI summary yet.
Reading 0:00
15s threshold

Open any app with a horizontally scrolling row โ€” a chip list, a tab bar, a row of story avatars โ€” and look at the right edge. Chances are there's a soft fade there, a little visual whisper that says "there's more, keep scrolling." Now switch the page to dark mode, or scroll until a product photo sits right under that fade.

Watch the fade turn into a flat, wrong-colored smudge sitting on top of the photo.

That's not a rendering bug. That's the fade working exactly as built โ€” and the way it's built is the problem.

.scroll-row { position : relative ; overflow-x : auto ; }

.scroll-row : : after { content : "" ; position : absolute ; top : 0 ; right : 0 ; bottom : 0 ; width : 40px ; background : linear-gradient ( to right , transparent , white ) ; pointer-events : none ; }

Enter fullscreen mode

Exit fullscreen mode

That's the standard trick, and it's everywhere.โ€ฆ

Continue reading โ€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.