#CSS

Change Background Image Opacity Without Fading the Content in CSS

Available for new projects • My FREE templatesWeb Design

Author: Radu

Ever tried to make a background image see-through with CSS and ended up fading everything inside too? Yeah, I’ve been there.

Turns out there’s a better way than using opacity on the whole element (which messes with the children).

Let me show you a neat little trick I use to keep my content sharp while giving the background image a soft, transparent look.

The Problem

When you set something like this:

.foo {
    opacity: 0.5;
}

It does make the background more transparent… but it also makes all the text, images, buttons, and everything inside transparent too. Not cool.

The Solution

Instead of using the opacity property, we can blend a semi-transparent background color with the background image using background-blend-mode.

Here’s how it works:

.foo {
    background-image: url(image.png);
    background-color: rgba(255, 255, 255, 0.7);
    background-blend-mode: lighten;
}

What’s Going On Here?

Let me break it down:

  • background-image: your actual image file.
  • background-color: a white color with 70% opacity. You can adjust this to make it more or less see-through.
  • background-blend-mode: lighten: this is where the magic happens. It blends the color and image in a way that lightens things up without touching your content inside the container.

And voilà! You’ve got a transparent background image that leaves all the child elements untouched.

Bonus Tips

  • Play around with background-blend-mode values like multiply, overlay, or screen to get different vibes.
  • Don’t forget background-size: cover; if you want the image to fully fill the container.
  • Use background-repeat: no-repeat; to make sure your image doesn’t tile.

That’s a Wrap

I hope this post has helped you out.

If you're interested in my web design services or free templates, want to collaborate, or just have something to say, feel free to shoot me a message.

About Radu

I've been working online from home for over 11 years, gaining valuable experience and developing a wide range of skills, including web design and development, optimization, and SEO.

More posts