Align block to the center (table with scroll)
https://habr.com/ru/post/238449
by Serhio Magpie
HTML
<div class="parent">
<div class="table">
<div class="cell">
<div class="block">
<img src="https://habrastorage.org/files/50f/7b2/1cc/50f7b21ccabd4b20bc0369f228138b5b.jpg" alt="">
</div>
</div>
</div>
</div>
CSS
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
.parent {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
overflow: auto;
}
.table {
width: 100%;
height: 100%;
display: table;
}
.cell {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.block {
display: inline-block;
background: #60a839;
}
.block img {
display: block;
border: none;
}