2

网址:http: //vixenology.com/

在标准缩放级别下,整个博客向左对齐,右侧有一个巨大的无人区。如何缩小页面大小,使博客在所有缩放级别居中?

我尝试了一些简单的 css,但似乎无法弄清楚。

谢谢!

4

3 回答 3

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 */ }

类似的东西。

于 2011-06-05T00:13:40.350 回答
1

这是你要找的:

.main-width { margin: 0px auto; }
于 2011-06-05T00:12:43.063 回答
0

给包装 div 一个固定的宽度并给它一个边距:0 auto

于 2011-06-05T00:12:57.917 回答