Created
January 11, 2013 00:42
-
-
Save jrsalunga/4507054 to your computer and use it in GitHub Desktop.
How To Work With Transparent Colors And Images In CSS Think about a div with a few paragraphs inside. Maybe you want the background of the div to be semi-transparent to allow what’s behind it to show through. Odds are you’d still like the text inside to be fully opaque so it’s easily read. However, because the paragraphs are children of the div,…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.element { | |
position:relative; | |
z-index:1; | |
} | |
.element:before { | |
content:""; | |
position:absolute; | |
z-index:-0; | |
top:0; | |
bottom:0; | |
left:0; | |
right:0; | |
background:url("path-to-image.jpg"); | |
opacity:0.5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment