How to code this "fade gradient" on image bottom?

I always saw this on popular websites but don't know how to achieve it.
4 Replies
Chris Bolson
Chris Bolson•2y ago
There are several ways to achieve this but basically you need to add a pseudo element to the image container, and give it a linear gradient background , bottom to top, that goes from from black (or whatever color you want) to transparent. Alternatively you could add the pseudo element to the text element.
Jochem
Jochem•2y ago
no need for a pseudo element if you use the text element, you can just set the background on there directly
Chris Bolson
Chris Bolson•2y ago
Yes, there are several methods 😀 I would use a pseudo element to ensure that the gradient was the same in all the cards as the number of lines of text might be different in each one which could cause them to be different.
Jochem
Jochem•2y ago
I'd probably use a background gradient for that exact reason, so that the text was legible on a similar colored background no matter if it was one or two lines 😄
Want results from more Discord servers?
Add your server