JSFiddle - React, Tailwind, and code Playground

HTML

<div class="outer">
    
    <div class="inner">
        I am centered within the outer <code>div</code>.
    </div>
    
</div>

CSS

.outer{
    
    display: flex;   /* You may need to prefix this depending on the required browser support. */
    
    width: 100%;
    height: 250px;
    
    align-items: center;       /* Cross axis (defaults to vertical)   */
    justify-content: center;   /* Main axis (defaults to horizontal). */
    
    background: #f5f5f5;
    
}

.inner{
    padding: 1em;
    background: red;
}