CSS 高度居中方案

实现高度自适应并且上下居中

<div id="wrap">
    <div class="box">DemoSeat</div>
</div>
<style>
#wrap {
    position: fiexd;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    .box {
        veralign: middle;
        width: 500px;
        margin: 0 auto;
        &:before {
            content: '';
            display: inline-block;
            width: 0;
            height: 100%;
            veralign: middle;
        }
    }
}
</style>
posted @ 2019-06-03 18:19  universe-cosmo  阅读(427)  评论(0编辑  收藏  举报