JSFiddle - React, Tailwind, and code Playground
by jamesclebio
HTML
<main>
<div>
Eu sou um elemento block com largura e altura fixos, centralizado verticalmente em meu elemento pai.
</div>
</main>
CSS
body {
background: #0C2939;
font-size: 80%;
padding: 20px;
}
main {
position: relative;
background: white;
height: 200px;
width: 60%;
margin: 0 auto;
padding: 20px;
resize: both;
overflow: auto;
}
main div {
background: black;
color: white;
width: 200px;
height: 100px;
margin: -70px 0 0 -120px;
position: absolute;
top: 50%;
left: 50%;
padding: 20px;
}