中心页面内容div在中心网页中

时间:2013-02-18 22:53:04

标签: css xhtml

请记住,这个问题可能已经以多种形式提出。我似乎没有得到它。我想在中心网页中将标头,顶部导航,页面内容和页脚div居中。我是新手,它踢我的你知道什么。究竟我需要做什么?

2 个答案:

答案 0 :(得分:1)

将所有内部div包装在另一个div中。通常称为/入级容器或包装。

然后在容器/包装器上设置宽度并将边距“零”。

<div class="container">
   <!-- all of your site in here -->
</div>

.container {
width:960px;
margin:0 auto;
}

答案 1 :(得分:0)

你应该使用这样的东西:

    .wrapper{
                margin:0 auto;
                width:960px;
}

这将为top和amp设置0的余量。 div的底部和左右自动。

相关问题