A background image needs to be faded, without also fading the actual content sitting on top of it.
⚡ Quick Fix (TL;DR)
The Culprit: Setting opacity directly on a section fades everything inside it, including the text and content, not just the background.
The Fix: Create a separate image layer using a pseudo-element, so its opacity can be controlled independently of the real content.
.example {
position: relative;
isolation: isolate;
}
.example::before {
content: "";
position: absolute;
inset: 0;
background-image: url("IMAGE-URL-HERE");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
opacity: 0.25;
z-index: -1;
}
Rather not untangle this yourself? Our Done-For-You team handles exactly this kind of thing, start to finish.
See DFY options →
Was this helpful?
Thanks for the feedback!
Tagged in :