Skip to content

Setting Background Image Opacity #3617

Answered by simonswiss
GideonBrimleaf asked this question in Help
Discussion options

You must be logged in to vote

Hey!

Currently it's not possible to add transparency to a background image since the bg-opacity-{n} updates the --tw-bg-opacity CSS variable, which affects background color classes - not background images.

I'd achieve it by having an "overlay" div with transparent background over the top of the image. Not exactly the same effect, but an overlayed image works quite well in many situations 👍

Here's an example in Tailwind Play:

https://play.tailwindcss.com/RnQTIA1FS1

Hope it helps!

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@GideonBrimleaf
Comment options

Answer selected by simonswiss
Comment options

You must be logged in to vote
1 reply
@wongjn
Comment options

Comment options

You must be logged in to vote
1 reply
@simesy
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
7 participants