0

如何将页脚推到页面底部?这是我目前拥有的一个示例:hansmoolman.com 正如您所看到的,页脚被推到我的 2 个左右容器下方。我怎样才能解决这个问题。我对某些元素使用了相对定位,因为必须将红色横幅推到标题栏上并给出 + z-index。我在网上找到了一些将页脚粘贴到底部的解决方案,但这并不能解决我的问题,因为如果其中的内容不足以填满整个页面,页脚仍然会出现在我的 2 列中。

所以我想要的是让页脚始终跟随所有其余内容的下方(粘在底部我可以稍后解决)。

有一点 CSS 代码所以这里没有添加,如果需要可以添加

4

3 回答 3

2

你的 CSS 看起来像:

#footer {
    background-color: #FFFEF0;
    border: 1px solid #000000;
    clear: both;
    height: auto;
    margin-top: -100px; /* >> Remove This*/
    overflow: hidden;
    position: relative;
    top: -200px; /* >> Remove This*/
    width: 100%;
    z-index: -1;
}

删除以下 CSS 规则#footer

top: -200px; 
margin-top: -100px;
于 2012-08-23T11:51:58.280 回答
1

尝试 clear:both 为您的页脚容器标签,考虑到它有 display:block; 放

于 2012-08-23T11:51:37.917 回答
1

正确对齐内容。你必须在你的CSS中做一些改变。

首先删除:

top: -200px;
width: 100%;
z-index: -1;

从你的#footer.

并将您的更改#mainContentContainer为:

#mainContentContainer
{
    min-height: 400px;
    overflow: auto;
    position: relative;
    width: 100%;
}
于 2012-08-23T12:07:38.890 回答