Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created May 5, 2012 20:22
Show Gist options
  • Save LeaVerou/2605356 to your computer and use it in GitHub Desktop.
Save LeaVerou/2605356 to your computer and use it in GitHub Desktop.
Weird behavior when combining opacity & z-index: -1
/**
* 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;
}
<div>
<div></div>
</div>
{"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