Created
May 5, 2012 20:22
-
-
Save LeaVerou/2605356 to your computer and use it in GitHub Desktop.
Weird behavior when combining opacity & z-index: -1
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
/** | |
* Weird behavior when combining opacity & z-index: -1 | |
*/ | |
div { | |
position: relative; | |
width: 200px; height: 200px; | |
background: yellowgreen; | |
/* Try commenting this or setting it to 1: */ | |
opacity: .9; | |
} | |
div > div { | |
position:absolute; | |
z-index: -1; | |
width: 200px; height: 200px; | |
background: #d00; | |
} |
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
<div> | |
<div></div> | |
</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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment