我目前这样做:
html:
<div id="narrate">
<h1>Imagine everything.</h1>
<span class="preloading">
<i class="icon-spinner icon-spin icon-2x"></i>
</span>
</div>
CSS
#narrate {
margin:0 ;
padding: 0;
text-align: center;
position: absolute;
top: 50%;
left: 50%;
height: 300px;
width: 500px;
margin-top: -50px;
margin-left: -200px;
height: 20px;
}
h1 {
font-size: 3em;
font-family: 'Source Sans Pro', sans-serif !important;
font-weight: 700;
}
.preloading {
height: 20px;
visibility: hidden;
text-align: center;
}
我希望 h1 和微调器图标都位于页面中心,微调器图标位于 h1 下方。
上面的代码并没有真正居中,有一些像素输出位置。
我努力了:
#narrate {
margin:0 ;
padding: 0;
text-align: center;
position: absolute;
top: 50%;
left: 50%;
height: 300px;
width: 500px;
margin-top: -150px;
margin-left: -250px;
height: 20px;
}