JSFiddle - React, Tailwind, and code Playground
by rbrtsmith
HTML
<div class="unknown">
<div class="unknown-inner">
<div clasS="table">
<div class="table-cell">
<p> centered content centered content centered content centered content</p>
</div>
</div>
</div>
</div>
CSS
.unknown {
position: relative;
height: 0;
padding-bottom: 35%;
background: blue;
}
.unknown-inner {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.table {
display: table;
width: 100%;
height: 100%;
}
.table-cell {
display: table-cell;
width: 100%;
vertical-align: middle;
text-align: center;
}
p {
display: inline-block;
width: 50%;
margin: 0;
background: green;
}