Join the Webstudio community

Updated 4 months ago

How can I add an overlay on image background ?

At a glance

The community member Romaric wants to add an overlay with an RGBA color (rgba(0, 0, 0, 0.3)) on an image background to improve the contrast of a message, similar to what Webflow does. Romaric tried adding a gradient but it didn't work. Other community members explain that in CSS, background colors cannot be added directly over images, so Webflow and the community members will convert the single color to a gradient (like linear-gradient(#333, #333)) to achieve the desired effect. The community members confirm that this solution works and provide a link to a related UI project.

Useful resources
Hey,

I would to add an overlay [ rgba(0, 0, 0, 0.3) ] on image background in order to improve contrast message like in Webflow.

I tried to add a gradient but it doesn't work

Thank you for your help

Romaric
Attachment
CleanShot_2024-11-05_at_18.19.29.png
J
R
6 comments
Hey we are creating a UI for this but what technically happens under the hood is a gradient is added. Background colors can't be added over images in CSS so what Webflow and what we will do is convert the single color to a gradient
like linear-gradient(#333, #333)
so just copy what you have in the color field and replace my #333's with that. Then add that as a gradient
Perfect! It works πŸ™
Attachment
CleanShot_2024-11-05_at_18.36.25.png
Add a reply
Sign up and join the conversation on Discord