以变换为中心
HTML:
<div class="wrapper">
<div class="centered">
centered
</div>
</div>
CSS:
.wrapper {
position: relative;
height: 600px;
}
.centered {
position: absolute;
z-index: 999;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
}