JSFiddle - React, Tailwind, and code Playground
by Daniel Dubois
HTML
<main>
<div>
Je suis un élément de niveau bloc avec une hauteur fixe, centré verticalement à l'intérieur de mon élément parent.
</div>
</main>
CSS
body {
background: #3e58aa;
font-size: 80%;
}
main {
background: white;
height: 300px;
margin: 20px;
width: 300px;
position: relative;
resize: vertical;
overflow: auto;
}
main div {
position: absolute;
top: 50%;
left: 20px;
right: 20px;
height: 100px;
margin-top: -70px;
background: #CCDCCD;
color: #3e58aa;
padding: 20px;
}