方法一:利用行高(line-height)定位
方法二:利用绝对定位
元素的宽度/2 = 负左边距
元素的高度/2 = 负上边距
在这个例子中,我们就是这么计算的
.vert {
width: 580px;
height: 190px;
position: absolute;
top: 50%;
left: 50%;
margin: -95px 0 0 -290px;
}
参考:http://www.cssxuexi.cn/forum.php?mod=viewthread&tid=337&extra=page%3D1