JSFiddle - React, Tailwind, and code Playground

by Christian Sonne

HTML

<div class="button">Hello</div>

CSS

.button {
  position: relative;
  display: inline-block;
  background: red;
  padding: 0.3em 1em;
  transform-origin: 50%;
  transition-property: transform;
  transition-duration: 0.5s;
}

.button:before {
  content: "What!";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: blue;
  transform: translateY(-100%) rotateX(90deg);
  transform-origin: 0 100%;
}

.button:hover {
  transform: rotateX(-90deg)
}