JSFiddle - React, Tailwind, and code Playground

HTML

<div id="container">
            <div id="top"></div>
            <div id="back"></div>
        </div>

CSS

#container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    position: relative;
    background: purple;
    width: 100%;
    height: 100vh;
}

#back{
    background: blue;
    height: 80%;
    width: 80%;
}

#top {
    position: absolute;
    background: red;
    width: 40%;
    height: 40%;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    margin-top: 12%;
    
}