使所有内容与我的标题div集中

时间:2012-06-25 11:15:47

标签: html css position alignment center

http://dl.dropbox.com/u/13722201/Dorset%20Designs/index.html 正如您在调整浏览器大小时所看到的那样,一切都集中在浏览器边缘接触主div,然后只有导航栏保持集中。 我知道这是我的编码问题,但我找不到问题。 这里也是css http://dl.dropbox.com/u/13722201/Dorset%20Designs/main.css

提前谢谢 阿兰,16岁

1 个答案:

答案 0 :(得分:4)

在你的样式表中进行以下编辑,请在下面找到: -

#main {
    background: none repeat scroll 0 0 #0099FF;
    box-shadow: 0 5px 10px 3px #000000;
    height: 1600px;
    left: 0; /* right: 20px; this has been changed to 0;*/
    margin-left: auto;
    margin-right: auto;
    position: absolute;
    right: 0; /* right: 20px; this has been changed to 0;*/
    top: 0;
    width: 960px;
    z-index: -1;
}

编辑 - 说明:

由于您已向20px提供了左右值,因此迫使<div id="main">从左侧移动20px。这是20px空间在您调整浏览器大小以适应div时产生的共鸣。

相关问题