<p>Click card to open</p>

<div class="card__container js-card-opener">
  <div class="card">
    <div class="card__panel card__panel--front">
      <h1>Hello!</h1>
    </div>
    <div class="card__panel card__panel--inside-left">
    </div>
    <div class="card__panel card__panel--inside-right">
      <p>Happy everything!</p>
      <p>Your friend, Tammy</p>
    </div>
  </div>

</div>
body {
  text-align: center;
  background: gray;
}

.card__container {
  cursor: pointer;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  perspective: 1400px;
  transition: all 0.2s ease;

  @media (min-width: 768px) {
    .open & {
      transform: translate(0%, -50%);
    }
  }
}

.card {
  max-width: 400px;
  max-height: 600px;
  width: 80vw;
  height: 120vw;
  transform-style: preserve-3d;
  transform: rotateX(65deg);
  transition: all 1s ease;

  .open & {
    transform: rotateX(0deg);
  }

  &__panel {
    border: 1px solid black;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    transition: all 1s ease;
    backface-visibility: visible;
    transform-origin: left;
    transform-style: preserve-3D;
    transform: rotate3d(0, 1, 0, 0deg);

    &--front {
      backface-visibility: hidden;
      background: #6288e6;
      z-index: 1;

      .open & {
        transform: rotate3d(0, 1, 0, -170deg);
      }
    }

    &--inside-left {
      background: #fff;
      z-index: 0;

      .open & {
        transform: rotate3d(0, 1, 0, -170deg);
      }
    }
    &--inside-right {
      border-left: none;
      background: #fff;
      z-index: -1;
    }
  }
}
View Compiled
const openBtn = document.querySelector(".js-card-opener");

openBtn.onclick = function () {
  document.body.classList.toggle("open");
};
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.