JSFiddle - React, Tailwind, and code Playground
by camel2243
HTML
<div id="div1">
<div id="div2">
</div>
</div>
CSS
#div1 {
background-color: #0F0;
position: relative;
width: 100px;
height: 150px;
}
#div2
{
position: absolute;
background-color: #F00;
width: 100px;
height: 40px;
top:0;
bottom:0;
left:0;
right:0;
margin:auto;
}