让内容上下左右居中
.vert { width: 500px; height: 200px; position: absolute; top: 50%; left: 50%; margin-top: -100px; margin-left: -250px; }
内容上下左右居中
上边的margin计算公式为:
* Width of Element / 2 = Negative Left Margin
* Height of Element / 2 = Negative Top Margin
.vert { width: 500px; height: 200px; position: absolute; top: 50%; left: 50%; margin-top: -100px; margin-left: -250px; }
内容上下左右居中
上边的margin计算公式为:
* Width of Element / 2 = Negative Left Margin
* Height of Element / 2 = Negative Top Margin