我的总体目标是垂直居中一些文本。现在我有一个包含 p 的 div。div是:
.container{
margin-left: auto;
margin-right: auto;
height: auto;
min-height: 100px;
border: 1px solid red;
width: 60%;
overflow: hidden;
}
和 p:
.welcome_title{
float: left;
width: 30%;
height: 100%;
min-height: 100%;
font-size: 200%;
vertical-align: middle;
text-align: center;
}
这样做是使 p 的高度为屏幕的 100%,而不是其父级。有什么帮助吗?