JSFiddle - React, Tailwind, and code Playground

by paulL

HTML

<div id="card-container">
    <div id="card">
        <div class="back">This is the back of the card</div>
        <div class="front">This is the front of the card</div>
    </div>
</div>

CSS

#card {
    -webkit-transform-style: preserve-3d;
    -webkit-perspective: 1000;
    width: 250px;
    height: 250px;
    position: relative;
}   
.back, .front {
    position: absolute;
    -webkit-backface-visibility: hidden;
    -webkit-transition: -webkit-transform 1s ease-in;
    width: 100%;
    height: 100%;   
    padding: 20px;
    font-family: Helvetica, Arial, sans-serif;
    color: #fff;    
    font-weight: bold;
    box-shadow: inset 0px 0px 20px rgba(0,0,0,0.4);
    border-radius: 4px;
}
.back {
    -webkit-transform: rotateY(180deg);
    background: url('http://www.inserthtml.com/goose.jpeg');
    overflow: hidden;
}   
.front {
    background: #7f37c2;
}
#card-container {
    display: inline-block;
    text-align: justify;
}   
#card-container:hover .back {   
    -webkit-transform: rotateY(0deg);
}
#card-container:hover .front {      
    -webkit-transform: rotateY(-180deg);
}