Center Div CSS
.center {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Puzzled Penguin
.center {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.parent {
position: relative;
}
.child {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.parent {
display: flex;
justify-content: center;
align-items: center;
}
IMG.displayed {
display: block;
margin-left: auto;
margin-right: auto }
...
<IMG class="displayed" src="..." alt="...">
.parent {
position: relative;
}
.child {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.container{
margin: 0 auto;
display: flex;
align-items: center;
}