DIV布局水平居中于浏览器中(margin:0 auto作用语法)
margin:0 auto 设置对象上下间距为0,左右自动。 可拆分: margin:0 auto 0 auto(上下) 还可拆分为:margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;
注意:
如果要让DIV布局居中浏览器中,加入margin:0 auto就不能加入float浮动样式,避免逻辑错误,造成布局居中不兼容。
margin:0 auto 设置对象上下间距为0,左右自动。 可拆分: margin:0 auto 0 auto(上下) 还可拆分为:margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;
注意:
如果要让DIV布局居中浏览器中,加入margin:0 auto就不能加入float浮动样式,避免逻辑错误,造成布局居中不兼容。