I am trying to create a div
that is centered both vertically and horizontally using display:table
. It works perfectly in Chrome but not displaying correctly in Firefox.
The id of the div
is #content
:
#content {
background: red;
width: 367px;
height: 441px;
display: table;
}
.centered {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
margin: auto;
}
<div id="content" class="centered">
<img src="https://www.google.com/images/srpr/logo11w.png" id="img-logo" alt="Google logo">
</div>