日期:2014-05-16  浏览次数:20687 次

CSS3 水平垂直居中
Center the child elements of a div box by using the box-align and box-pack properties together:

div
{
width:350px;
height:100px;
border:1px solid black;

/* Internet Explorer 10 */
display:-ms-flexbox;
-ms-flex-pack:center;
-ms-flex-align:center;

/* Firefox */
display:-moz-box;
-moz-box-pack:center;
-moz-box-align:center;

/* Safari, Opera, and Chrome */
display:-webkit-box;
-webkit-box-pack:center;
-webkit-box-align:center;

/* W3C */
display:box;
box-pack:center;
box-align:center;
}

?From:http://www.w3schools.com/cssref/css3_pr_box-pack.asp