JSFiddle - React, Tailwind, and code Playground
HTML
<label>
<input type="checkbox" />
<div class="card">
<div class="front">Front</div>
<div class="back">Back</div>
<div class="left_size"></div>
<div class="right_size"></div>
</div>
</label>
CSS
body {
background: transparent;
font-size: 50px;
}
label {
-webkit-perspective: 1000px;
perspective: 1000px;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
display: block;
width: 300px;
height: 200px;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
cursor: pointer;
}
.card {
position: relative;
height: 100%;
width: 100%;
transform-style: preserve-3d;
transition: all 600ms;
}
.card .front,
.card .back {
position: absolute;
height: 100%;
width: 100%;
background: lightblue;
text-align: center;
line-height: 200px;
backface-visibility: hidden;
border-radius: 40px;
}
.left_size {
background-color: orange;
position: absolute;
height: 100%;
width: 18px;
transform: translateX(-9px) rotateY(90deg);
}
.right_size {
background-color: yellowgreen;
position: absolute;
height: 100%;
width: 18px;
right: 0;
transform: translateX(9px) rotateY(90deg);
}
.card .front {
transform: translateZ(8px);
}
.card .back {
background: red;
color: #FFF;
transform: rotateY(180deg) translateZ(8px);
}
label:hover .card {
transform: rotateY(20deg);
}
input {
display: none;
}
:checked+.card {
transform: rotateY(180deg);
}
label:hover :checked+.card {
transform: rotateY(160deg);
}