JSFiddle - React, Tailwind, and code Playground

by Steven Watson

HTML

<div class="c-flip-card">
  <div class="c-flip-card__inner">
    <div class="c-flip-card__front">
      <img src="img_avatar.png" alt="Avatar" style="width:300px;height:300px;">
    </div>
    <div class="c-flip-card__back">
      <h1>John Doe</h1> 
      <p>Architect & Engineer</p> 
      <p>We love that guy</p>
    </div>
  </div>
</div>

SCSS

/* The flip card container - set the width and height to whatever you want. We have added the border property to demonstrate that the flip itself goes out of the box on hover (remove perspective if you don't want the 3D effect */
.c-flip-card {
    background-color: transparent;
    width: 180px;
    height: 200px;
    border: 1px solid #f1f1f1;
    perspective: 1000px;
    /* Do an horizontal flip when you move the mouse over the flip box container */
    &:hover {
        z-index: 10;
        position: relative;
    }
    &:hover .c-flip-card__inner {
        transform: rotateY(180deg) scale(1.4);
    }
    /* This container is needed to position the front and back side */
    .c-flip-card__inner {
        cursor:pointer;
        position: relative;
        width: 100%;
        height: 100%;
        text-align: center;
        transition: transform 0.8s;
        transform-style: preserve-3d;
    }
    /* Position the front and back side */
    .c-flip-card__front, .c-flip-card__back {
        position: absolute;
        width: 100%;
        height: 100%;
        backface-visibility: hidden;
    }
    /* Style the front side (fallback if image is missing) */
    .c-flip-card__front {
        background-color: #bbb;
        color: black;
    }
    /* Style the back side */
    .c-flip-card__back {
        background-color: red;
        color: white;
        transform: rotateY(180deg);
    }
    .abc{
        transform: scale(0.7);
        h1, p{
            color:#000;
        }
    }
}