JSFiddle - React, Tailwind, and code Playground
by Christian Sonne
HTML
<div id="one" class="container">
<div></div>
</div>
<div id="two" class="container">
<div></div>
</div>
CSS
.container {
width: 600px;
height: 400px;
background: red;
position: relative;
margin: 10px;
}
#one div {
position: absolute;
top: 50%;
left: 50%;
width: 300px;
height: 200px;
background: green;
}
#two div {
position: absolute;
top: 50%;
left: 50%;
width: 300px;
height: 200px;
background: green;
transform: translate(-50%, -50%);
}