您好我正在尝试将我的主要内容部分作为灰色部分。它集中在Mozilla,但不是IE(我希望IE将从所有计算机中删除)。它是margin-left:auto不起作用。有人可以帮我解决这个问题吗?
<html>
<head>
</head>
<body style="background-color:black;">
<div style="background-color:gray; margin-left:auto; margin-right:auto; width:1000px; height:1000px; padding-top:0px; margin-top:-10px;">
<p style="margin-left:auto; margin-right:auto; width:500px; background-color:red; text-align:center">This is a test.</p>
</div>
</body>
</html>
答案 0 :(得分:4)
您应该在页面的第一行添加doctype!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">