I am trying to make DIV verticle and horizontal center. I am using code from here : How can I vertically center a div element for all browsers using CSS?
I tried both
display: grid;
place-items: center;
and
display: flex;
align-items: center;
justify-content: center;
My code :
body {
background: #000000 50% 50%;
overflow-x: hidden;
overflow-y: hidden;
}
.video {
display: grid;
place-items: center;
}
<body> <div class="video">
<img src="https://place-hold.it/25x25" />
</div> </body>
Horizontal center : Success
Vertical center : failed
with above two CSS code.