1.html行内元素总结:span、a、lable、strong、b、textarea、em、select、label、i、img等。
性质:设置width、height、margin-bottom、margin-top、padding-top、padding-bottom设置无效。可以通过line-height设置行高。
居中:
水平居中:
div{tex-align:center;}
垂直居中:
div{height:20px; line-height:20px; }
水平垂直居中:
div{height:20px; line-height-0px; tex-align:center}
2.块级元素:div 、table、ul、form、p、h1、ol(有序列表)、dl等。
水平居中:
div p{width:300px; margin:0 auto;} p标签一定要设置宽度
垂直居中:
1.设置父容器宽度
2.为要居中的元素添加样式{margin:0 aotu; height:200px; line-height:200px;}