Using ‹section› instead of ‹div› is not a problem (?) so flex is a better solution
.wrapper {height:max-content; padding:20px; display:flex; justify-content:space-evenly; align-items:center; background-color:#4BB1E7;} .contain {width:auto;height:auto; margin:20px!important; padding:25px; border:2px solid blue;}

Status?? .. CAUTION: bad fix used to make it work -› }}
1/ Using
2/ Border doesn’t display
.parent {position:relative; min-height:50%; height:max-content;display:flex;justify-content:space-evenly;align-items:center; padding:20px!important;}} .child {position:absolute;top:50%;left:50%;transform:translate(-50%, -50%); width:max-content;height:max-content; margin:auto; padding:30px!important; border:2px solid blue!important;} .child img {display:block; width:15vw;height:auto; margin-top:25px; margin-left:50%;transform:translateX(-50%);}
1/ The parent container (relative) has to have a defined height..
otherwise this does not work!..
parent {position:relative; min-height:100%;}}
