JSFiddle - React, Tailwind, and code Playground
by Codemonkey
HTML
<div class="outer">
<div class="middle">
<div class="inner">
<div class="content">
I have a dynamic size and am therefore a tough nugget, but I'll still center both vertically and horizontally!
</div>
</div>
</div>
</div>
CSS
.outer
{
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
}
.middle
{
display: table;
width: 100%;
height: 100%;
}
.inner
{
display: table-cell;
vertical-align: middle;
text-align: center;
}
.content
{
display: inline-block;
background-color: #abcdef;
}