亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

關于margin居中縮寫問題


<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>一列布局改混合三列布局</title>

<style type="text/css">

body{margin:0;padding:0;}

.top{height:200px;background:#00F;}

.main{width:300px;height:800px;background:#0FF;margin:10 auto;}

.bottom{width:300px;height:200px;background:#999;margin:0 auto;}

</style>

</head>

<body>

? ? <div class="top"></div>

? ? <div class="main"></div>

? ? <div class="bottom"></div>

</body>

</html>

在給中間的main居中?時,代碼"margin:0?auto"可以使main居中,,我用“margin-top:10px;margin-left:auto;margin-right:auto;”可以居中,還會在main上方空出10px,但是我用“margin:10?auto;”為什么就不能居中了?


正在回答

2 回答

margin:10 auto; ? 這里,10后面沒寫單位

margin:10px auto;

0 回復 有任何疑惑可以回復我~
#1

穩穩2 提問者

非常感謝!
2016-10-06 回復 有任何疑惑可以回復我~

截圖與問題無關

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
如何用CSS進行網頁布局
  • 參與學習       209566    人
  • 解答問題       1206    個

用最簡潔的案例教你布局的那些知識,這是前端工程師基本技能

進入課程

關于margin居中縮寫問題

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號