Css 将div扩展到页面底部不起作用

Css 将div扩展到页面底部不起作用,css,html,Css,Html,我已经试着确定这个div的长度有一段时间了,我确信它是完全简单的,只是没有看到它。内容“page”的div远远超出了页脚,我可以使用css中的minheight属性来操作长度,但是我想确保页脚/“page”div扩展到底部,而不管内容如何,所以我不想为div设置一个确定的长度 编辑: jsfiddle: 页脚cs #footer { background: #365F91; color: #000000; width:100%; height: 35px;

我已经试着确定这个div的长度有一段时间了,我确信它是完全简单的,只是没有看到它。内容“page”的div远远超出了页脚,我可以使用css中的minheight属性来操作长度,但是我想确保页脚/“page”div扩展到底部,而不管内容如何,所以我不想为div设置一个确定的长度

编辑: jsfiddle:

页脚cs

#footer {
    background: #365F91;
    color: #000000;
    width:100%;
    height: 35px;

    position:relative;

    bottom:0px;
    clear:both;
}

#footer p {
    margin: 0;
    text-align: center;
    font-size: 77%;
}

#footer a {
    text-decoration: underline;
    color: #FFFFFF;
}

#footer a:hover {
    text-decoration: none;
}

将页脚位置从相对更改为绝对没有改变

相对更改为
绝对
,并将
最小高度
#页面
中删除

#footer { position: absolute; }
您还需要确保每页只有1页


.

您想使用一种叫做粘性页脚的东西

或者您可以使用我的解决方案而不使用伪类
:after

bottom: -500px;
padding-bottom: -500px;

编辑:很抱歉,这里有我解决div问题的方法,而不是在旧学之后……将此添加到
#footer
css中

bottom: -500px;
padding-bottom: -500px;

CSS

#footer {
        background: #365F91;
        color: #000000;
        width:100%;
        height: 80px;
        position:relative;
        bottom: -500px; /* push to the bottom */
        padding-bottom: -500px; /* maintain equilibrium by giving footer its height!!*/
    }
编辑

如果内容超过,则使页脚拉伸到高度

#footer {
    background: #365F91;
    color: #000000;
    width:100%;
    height: 35px;

    position:relative;

    bottom:0px;
    clear:both;
}

#footer p {
    margin: 0;
    text-align: center;
    font-size: 77%;
}

#footer a {
    text-decoration: underline;
    color: #FFFFFF;
}

#footer a:hover {
    text-decoration: none;
}

如果您希望在内容超过时使用可滚动页脚

#footer {
    background: #365F91;
    color: #000000;
    width:100%;
    height: 35px;

    position:relative;

    bottom:0px;
    clear:both;
}

#footer p {
    margin: 0;
    text-align: center;
    font-size: 77%;
}

#footer a {
    text-decoration: underline;
    color: #FFFFFF;
}

#footer a:hover {
    text-decoration: none;
}


图片:请提供一把小提琴!!你可以在将来使用。这对每个人都有好处。这很有效,但我希望页脚留在页面底部。如果内容位于页脚下方,我希望页脚贴在底部,滚动条显示内容。您的意思是,如果内容超过高度,您希望页脚中有滚动条???@user3036496:添加了2个变体…请检查编辑部分是否有帮助!!这并没有解决问题,只是没有显示,因为没有背景图像。一旦背景图像显示内容下的空白消失。我想让一个div扩展到页脚,而不考虑页脚上的内容。我只希望背景图像显示在侧面,而中间是白色的内容,而不需要在侧面添加2个额外的div来容纳与前面相同的背景,页脚保持在同一位置,但没有背景图像,你看不到div没有向下延伸到页脚。如果我错了,请更正我…但我从问题中推断出页脚应该是可滚动的…你已经修复了!!