JSFiddle - React, Tailwind, and code Playground
by kougiland
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<figure class="flip">
<div class="card">
<div class="face front">
Image Front
</div>
<div class="face back">
Image Back
</div>
</div>
</figure>
CSS
.flip {
perspective: 800;
width: 400px;
height: 200px;
position: relative;
margin: 50px auto;
}
.flip:hover .card {
transform: rotatex(-180deg);
}
.flip .card {
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: 0.5s;
}
.flip .card .face {
width: 100%;
height: 100%;
position: absolute;
backface-visibility: hidden ;
z-index: 2;
font-family: Georgia;
font-size: 3em;
text-align: center;
line-height: 200px;
}
.flip .card .front {
position: absolute;
z-index: 1;
background: black;
color: white;
cursor: pointer;
}
.flip .card .back {
transform: rotatex(-180deg);
background: blue;
background: #ccc;
color: black;
cursor: pointer;
}