JSFiddle - React, Tailwind, and code Playground
by Alexander Malinov
January 27, 2014
HTML
<div id="flip-container">
<div id="flip">
<div class="front face">
<img src="http://css3.bradshawenterprises.com/images/Clown%20Fish.jpg" />
</div>
<div class="back face">
<p>This is nice for exposing more information about an image.</p>
</div>
</div>
</div>
CSS
#flip-container {
position: relative;
margin: 0 auto;
width: 450px;
height: 281px;
z-index: 1;
-webkit-perspective: 600px;
-moz-perspective: 600px;
-o-perspective: 600px;
perspective: 600px;
}
#flip {
width: 100%;
height: 100%;
-moz-transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
-moz-transition: all 0.6s ease-in;
-webkit-transition: all 0.6s ease-in;
-o-transition: all 0.6s ease-in;
transition: all 0.6s ease-out;
}
#container:hover #flip {
-moz-transform: rotateX(180deg);
-webkit-transform: rotateX(180deg);
-o-transform: rotateX(180deg);
transform: rotateX(180deg);
}
.face {
position: absolute;
width: 100%;
height: 100%;
-moz-backface-visibility: hidden;
-webkit-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
.face.front {
position: absolute;
top: 0;
z-index: 900;
width: inherit;
height: inherit;
text-align: center;
}
.face.back {
position: absolute;
top: 0;
z-index: 800;
width: inherit;
height: inherit;
display: block;
-moz-transform: rotateX(180deg);
-webkit-transform: rotateX(180deg);
-o-transform: rotateX(180deg);
transform: rotateX(180deg);
box-sizing: border-box;
padding: 10px;
color: white;
text-align: center;
background-color: #aaa;
}