JSFiddle - React, Tailwind, and code Playground

by greatCar

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Centered Div</title>
    <style>
        .outer-div {
            background-color: yellow;
            width: 90vw;
            height: 90vh;
            display: flex;
            justify-content: center;
            align-items: center;
            box-sizing: border-box;
            margin: auto;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
        }
        .inner-div {
            background-color: blue;
            color: white;
            width: 50vw;
            height: 50vh;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
            box-sizing: border-box;
        }
    </style>
</head>
<body>
    <div class="outer-div">
        <div class="inner-div">
            Sample
        </div>
    </div>
</body>
</html>

CSS

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Arial, sans-serif;
    background-color: yellow;
}

.outer-div {
    background-color: yellow;
    width: 50%;
    height: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    
    
}

.inner-div {
    background-color: blue;
    color: white;
    width: 50%;
    height: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
}