為什么這樣寫定寬塊狀元素就不會居中顯示了,而把left去掉就可以居中了
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>定寬塊狀元素水平居中</title>
<style>
div{
? ? border:1px solid red;
? ? width:200px;
? ? margin-left:auto;
}
</style>
</head>
<body>
<div>我是定寬塊狀元素,我要水平居中顯示。</div>
</body>
</html>
2016-08-01
你加個margin-right:auto;看可不可以居中