I am trying to center a DIV vertically and horizontally in a page:
* {
box-sizing: border-box;
}
div.wrapper {
border: 1px solid red;
position: relative;
}
div.window {
border: 1px solid blue;
max-width: 300px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<div class="wrapper">
<div class="window">
Sed blandit augue quis diam tristique fringilla. Morbi tortor leo, efficitur sit amet ultrices non, lacinia ut nunc. Donec ut odio a diam semper consequat quis in leo.
</div>
</div>
Somehow this is not vertically centered. What am I doing wrong?