JSFiddle - React, Tailwind, and code Playground

by Derek Wood

HTML

<div class="parent">
  <div class="child">
    <span>stuff</span>
  </div>
</div>

CSS

.parent {
  position: relative; /* define context for absolutly positioned children */
  width: 200px;
  height: 200px;
  background: red;
}

.child {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
}