【发布时间】:2014-04-01 17:18:30
【问题描述】:
我的 div 高度是 100%,但是当我这样做时,我不知道如何将 P-tag 垂直居中。
我该怎么做?
HTML:
<div>
<p>This text has to be vertically centered.</div>
</div>
CSS:
html, body {
height: 100%;
width: 100%;
}
div {
height: 100%;
width: 100%;
background: url(http://www.windsim.com/images/sky/sky_107.bmp) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
p {
font-family: "Times New Roman", Times, serif;
color: black;
text-align: center;
font-size: 65px;
}
【问题讨论】:
-
哦抱歉,搜索没有找到这个,谢谢!