Skip to content

Instantly share code, notes, and snippets.

@nickspacek
Created January 13, 2011 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickspacek/778035 to your computer and use it in GitHub Desktop.
Save nickspacek/778035 to your computer and use it in GitHub Desktop.
Sample displaying CSS3 bug that occurs in Chrome when transitioning the opacity on a 3D-enabled element
<!DOCTYPE html>
<html>
<head>
<style>
.parent {
width: 300px;
height: 300px;
margin-bottom: 10px;
position: relative;
-webkit-perspective: 600;
-webkit-transition: 1s opacity ease-in-out;
border: 10px solid black;
}
.parent:active {
opacity: 0;
}
.front, .back {
width: 100%;
height: 100%;
position: absolute;
-webkit-transition: .5s all ease-in-out;
-webkit-backface-visibility: hidden;
}
.front {
background-color: red;
-webkit-transform: rotateY(0deg);
}
.back {
background-color: green;
-webkit-transform: rotateY(-180deg);
}
.parent:hover .front {
-webkit-transform: rotateY(180deg);
}
.parent:hover .back {
-webkit-transform: rotateY(0deg);
}
.translate {
-webkit-transform: translate3d(120px, 120px, 400px);
}
</style>
</head>
<body>
<h1>Fade + Flip test</h1>
<p>Click + hold the divs below to fade them out</p>
<p>
When you try this on the first box, it will immediately disappear; there is
a problem fading an element that contains children that have 3D styles
applied (that is just a theory)
</p>
<div class="parent">
<div class="front">
<p>This child starts facing forward</p>
<p>Mouse over to flip me over</p>
</div>
<div class="back">
<p>This child starts facing backward</p>
<p>Mouse off to flip me over</p>
</div>
</div>
<div class="parent">
<p>this one has no children</p>
</div>
<div class="parent">
<div class="translate">Translated</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment