我可以放棄css #wrapper,並將樣式向上移動到html標籤和body標籤以固定寬度,居中佈局?我可以放棄css #wrapper並將樣式轉換爲html標籤和body標籤嗎?
html {
background-color: lightgrey;
text-align: center;
}
body {
margin: 0 auto;
width: 800px;
background-color: white;
display: block;
}
它似乎在Firefox,Chrome和IE7 +上運行得非常好。潛在的缺點是什麼?
你打算通過這樣做獲得什麼?除了刪除2行的HTML? – PlantTheIdea 2013-02-28 15:47:47
就是這樣。 #wrapper代碼有點bug我。 – 2013-02-28 15:49:02
可能重複的[指定的身體CSS寬度是安全的嗎?](http://stackoverflow.com/questions/4986836/specified-body-css-width-is-safe) – Rawling 2013-02-28 15:53:59