div实现水平垂直居中
<div class="login-container"> <div class="login-top-table"> <div class="login-top-table-cell"> <img src="../../../static/images/login-icon.png" class="login-top-img"/> <span class="login-title">页面标题</span> </div> </div> </div>
.login-container { background: url(../../../static/images/login-bg.png) no-repeat; background-size: 100% 100%; height: calc(100vh); } .login-top-table { height: calc(30vh); display: table; width: 100%; } .login-top-table-cell { display: table-cell; vertical-align: middle; text-align: center; } .login-top-img { width: 130px; display: inline-block; vertical-align: middle; } .login-title { color: #F54427; font-size: 50px; font-weight: bold; margin-left: 20px; display: inline-block; vertical-align: middle; }
本文来自博客园,作者:cmwang2017,转载请注明原文链接:https://www.cnblogs.com/bm20131123/p/14953704.html