JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
   <h1>Vertical center with only 3 lines of code</h1>
   <section class="text">
       <p>I'm vertically aligned! Hi ho Silver, away!</p>
   </section>
</div>

CSS

body {
                font-family: Helvetica Neue, Helvetica, sans-serif;
                background: #59488b;
                padding: 1em;
            }
            .container {
                position: absolute;
                top: 50%;
                transform: translateY(-50%);
/*                left: 50%;
                transform: translateX(-50%);*/
                border: 2px solid red;
            }

            .text p {
                position: relative;
                top: 50%;
                transform: translateY(-50%);
            }

            section {
                display: block;
                max-width: 500px;
                background: #433669;
                margin: 0 auto 1em;
                height: 100px;
                border-radius: .5em;
                color: white;
                padding: 1em;
            }