Aligner l'image sur le centre de l'écran
.centered {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Outrageous Ostrich
.centered {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
}
.parent {
position: relative;
}
.child {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
img { display:block;
margin-left: auto;
margin-right:auto;
}
body {
margin: 0;
}
#over img {
margin-left: auto;
margin-right: auto;
display: block;
}
img{
object-fit: none;
object-position: center center; // or 50% 50%
}