JSFiddle - React, Tailwind, and code Playground

by trisketz

HTML

<div class="card-container">
  <div class="flip-container" ontouchstart="this.classList.toggle('hover');">
    <div class="flipper">
      <div class="front">
        <img src="yourimage.jpg" alt="your alt text for image">
        <h3>Your Title</h3>
        <p>Front Content</p>
      </div>
      <div class="back">
        <div class="summary">
          <p>Back content</p>
        </div>
        <a href="#" class="resource">View the Resource</a>
      </div>
    </div>
  </div>
</div>

CSS

/* Container for the cards */

.card-container {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  background-color: #F1F2F2;
  padding: 10px;
}


/* On QUBES, you can delete this img piece of css */

img {
  max-width: 100%;
}


/* entire container, keeps perspective */

.flip-container {
  -webkit-perspective: 1000px;
  perspective: 1000px;
}


/* flip the pane when hovered */

.flip-container:hover .flipper,
.flip-container.hover .flipper {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

.flip-container {
  margin: 10px;
}

.flip-container,
.front,
.back {
  overflow: hidden;
  width: 320px;
  height: 480px;
}

.front,
.back {
  background-color: #fff;
}

.front > h3 {
  padding: 0 10px;
}

.front > p {
  padding: 0 10px;
}

.summary {
  display: block;
  height: 400px;
  overflow: hidden;
  padding: 0 10px;
}

a.resource {
  display: block;
  background-color: #84bf41;
  color: #fff;
  width: 150px;
  text-align: center;
  font-weight: bold;
  text-decoration: none;
  border: none;
  border-radius: 3px;
  padding: 5px;
  margin: 0 auto;
}


/* flip speed goes here */

.flipper {
  -webkit-transition: 0.6s;
  transition: 0.6s;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  position: relative;
}


/* hide back of pane during swap */

.front,
.back {
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
}


/* front pane, placed above back */

.front {
  z-index: 2;
  /* for firefox 31 */
  -webkit-transform: rotateY(0deg);
  transform: rotateY(0deg);
}


/* back, initially hidden pane */

.back {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}