Html 页脚应根据屏幕大小进行调整

Html 页脚应根据屏幕大小进行调整,html,Html,我没有找到更好的标题来解释我的问题。 我想有一个页脚,这是在页面底部不断,(5像素的空间从底部)。当窗口变小时,它也应该移动。到目前为止,我的css是: #footer { height:40px; width: 1024px; background:#FFF; padding: 5px; clear: both; } 像这样,它位于最后一个div元素的下方。CSS 使用CSSPositionpropertyFixed CSS: #footer {

我没有找到更好的标题来解释我的问题。 我想有一个页脚,这是在页面底部不断,(5像素的空间从底部)。当窗口变小时,它也应该移动。到目前为止,我的css是:

#footer {
    height:40px;
    width: 1024px;
    background:#FFF;
    padding: 5px;
    clear: both;
}
像这样,它位于最后一个
div
元素的下方。

CSS


使用CSS
Position
property
Fixed

CSS

#footer {
    height:40px;
    width: 1024px;
    background:#FFF;
    padding: 5px;
    clear: both;
    position:fixed;
}
 #footer {
        height:40px;
        position:fixed;
        width: 1024px;
        background:#FFF;
        padding: 5px;
        clear: both;
        bottom:0;
        left:0;
        right:0;
    }
#footer {
    height:40px;
    width: 1024px;
    background:#FFF;
    padding: 5px;
    clear: both;
    position:fixed;
}