<!DOCTYPE> | |
<html> | |
<head> | |
<title>Opacity and positioning</title> | |
<style type="text/css" media="screen"> | |
.container { | |
position: relative; | |
height: 120px; | |
width: 120px; | |
padding: 10px; | |
margin: 50px; | |
-webkit-box-sizing: border-box; | |
border: 1px solid black; | |
} | |
.child { | |
height: 100px; | |
width: 100px; | |
opacity: 0.8; | |
background-color: red; | |
} | |
.inner { | |
position: absolute; | |
width: 100px; | |
height: 100px; | |
background-color: green; | |
} | |
.compositing { | |
-webkit-transform: translateZ(0); | |
} | |
</style> | |
</head> | |
<body> | |
<p>You should see two green boxes below, with no red</p> | |
<div class="container"> | |
<div class="child"> | |
<div class="inner"></div> | |
</div> | |
</div> | |
<div class="container"> | |
<div class="child"> | |
<div class="inner compositing"></div> | |
</div> | |
</div> | |
</body> | |
</html> |