<main>
<div>
Je suis un élément de niveau bloc avec une hauteur et une largeur inconnue, centrée verticalement à l'intérieur de mon élément parent.
</div>
</main>
body {
background: #3e58aa;
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: #CCDCCD;
color: #3e58aa;
width: 50%;
transform: translate(-50%, -50%);
position: absolute;
top: 50%;
left: 50%;
padding: 20px;
resize: both;
overflow: auto;
}