JSFiddle - React, Tailwind, and code Playground
HTML
<div class=card class=flipped>
<figure class="front1">1</figure>
<figure class="back1">2</figure>
</div>
<div class=card class=flipped style="margin: 0 100px">
<figure class="front2">1</figure>
<figure class="back1">2</figure>
</div>
<div class=card class=flipped style="margin: 0 200px">
<figure class="front1">1</figure>
<figure class="back2">2</figure>
</div>
CSS
.card {
height: 80px;
width: 50px;
line-height: 80px;
font-size: 60px;
position: absolute;
text-align: center;
transform-style: preserve-3d;
}
.card .front1 {
background: red;
}
.card .back1 {
background: green;
}
.card .front2 {
background: red;
transform: rotateY(180deg);
}
.card .back2 {
background: green;
transform: rotateY(180deg);
}
.card figure {
position: absolute;
height: 100%;
width: 100%;
color: white;
}
JavaScript
// In the first example none is turned
// In the second example 'front2' is turned and not visible
// In the third example 'back2' is turned and not visible