2011-06-05 116 views
2

網址:http://vixenology.com/固定寬度頁面

在標準縮放級別,整個博客是左對齊並沒有這個巨大的無人區的權利。我如何削減頁面的大小,使博客以所有縮放級別爲中心?

我試過一些簡單的CSS,似乎無法弄清楚。

謝謝!

回答

1

這是你在找什麼:

.main-width { margin: 0px auto; } 
+0

.main-width {margin:0px auto; } < - 這完美的文字,但現在如果你縮小背景圖像左移..謝謝 – js111 2011-06-05 00:34:33

0

給包裝div的固定寬度,並給它一個保證金:0汽車

4

嗯。如何把你的主要內容在一個div和中心:

margin: 0 auto; 
width: /* the width of your content */ 

你不得不重新排列你的html標記;我嘗試過這樣做,但它切斷了你的背景。你必須將你的背景圖像從你想要居中的div中取出並放在div上。如果是有道理的..喜歡的東西:

<body> 
    <div id="bg"><!-- give this id the background-image in css --> 
     <div id="maincontent"> 
     <!-- this div contains all your content, everything that needs centering --> 
     </div> 
    </div 
</body> 

然後在你的CSS:

#bg { background-image: /* blabla */ } 
#maincontent { margin: 0 auto; width: /* width, as stated above */ } 

類似的東西。