2009-10-26 252 views
0

我想插入此保證金,但我不知道爲什麼...我希望它像 Twitter或TwitPic如何在頁面的左側和右側插入頁邊距?

我的CSS:

body { 
     margin: 40px; 
     margin-bottom: 50px; 
     padding: 0; 
     background-color: #edece9; 
     font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana"; 
     font-size: 13px; 
     color: #333; 
     } 
+0

您粘貼的代碼無法理解,請使用代碼標籤 – Xinus 2009-10-26 14:48:37

回答

1

假設一個頁面結構,像這樣的div:

<!DOCTYPE html> 
<html> 
    <head> 
    <link type="text/css" rel="stylesheet" href="style.css" /> 
    </head> 
    <body> 
    <div id="main"> 
    </div> 
    </body> 
</html> 

然後風格.css應該看起來像:

* {margin:0;} 
div#main { 
    width:800px; 
    margin:0 auto; 
} 
0

Twitter使用固定寬度的DIV這使用margin-left:auto;margin-right:auto。這將居中水平

0

你需要把一個div與一固定(您想要的頁面寬度,並把它margin:0 auto