JSFiddle - React, Tailwind, and code Playground

HTML

<div class="div1">
    <div class="div2">vertically aligned while
        <br />height is not fixed but
        <br />based on content height</div>
</div>

CSS

body {
    display: table;
    width: 100%;
}
.div1 {
    height:200px;
    background-color: red;
    position:relative;
    display: table-cell;
    vertical-align: middle;
}
.div2 {
    border: 1px solid;
    background-color: orchid;
    text-decoration: none;
    letter-spacing: 1px;
    text-transform:uppercase;
    padding: 5px;
}