<div style=\"width:1000px;margin:0 auto;\">
<div style=\"background-color:red; text-align:left;\">
区块1
</div>
<div style=\"background-color:yellow;\">
区块2
</div>
</div>
在IE9 下面 本来应该居中的,结果显示为居左.
解决:
1.
在IE9以上的版本中,只需要设置 margin:0px auto; 就可以使得DIV居中
2.
在IE9以下的版本中,需要如下设置
<div style=\"text-align:center\">
<div style=\"margin-left:auto ; margin-right:auto\"></div>
</div>
其中的子div方可实现居中。
本文地址:https://www.stayed.cn/item/17357
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我