JSFiddle - React, Tailwind, and code Playground
HTML
<div class="parent">
<div class="child"></div>
</div>
CSS
.parent{
position: relative;
width: 300px;
height: 300px;
background: #cccccc;
}
.child {
position: absolute;
width: 50%;
height: 50%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: palevioletred;
}