JSFiddle - React, Tailwind, and code Playground
HTML
<div id="one" class="screen">
<span>one</span>
</div>
<div id="two" class="screen">
<span>two two two</span>
</div>
<div id="three" class="screen">
<span>three</span>
</div>
CSS
div.screen {
margin: 0 0 10px;
border: 3px solid;
text-align: center;
position: relative;
}
#one {
height: 200px;
width: 300px;
border-color: blue;
}
#one span { line-height: 200px; }
#two {
height: 100px;
width: 500px;
border-color: green;
}
#two span { line-height: 100px; }
#three {
height: 150px;
width: 400px;
border-color: orange;
}
#three span { line-height: 150px; }
span {
font-size: 20px;
vertical-align: middle;
background-color: pink;
display: inline-block;
padding: 0 10px;
}