通过媒体查询在移动设备上显示常量页脚

时间:2014-05-24 01:09:32

标签: css media-queries

我正在尝试在移动浏览器的屏幕底部显示固定页脚。我已经尝试将位置:固定在页脚ID中。但是,它仍然无法正常工作。当用户向下滚动页面时,如何将页脚设置为连续显示?

#footer {
    color: #333333;
    font-size: 70%;
    font-style: italic;
    text-align: center;
    padding: 0;
    position: fixed;
}

1 个答案:

答案 0 :(得分:0)

这样做:

#footer {
    color: #333333;
    font-size: 70%;
    font-style: italic;
    text-align: center;
    padding: 0;
    position: fixed;
    bottom: 0px;
    width: 100%;
}

'底部:0px'将页脚固定在屏幕底部,宽度:100%'将页脚内容居中。您还必须添加背景颜色,以便页面内容不会通过页脚显示。

另外,正如@Adrift所说,从页脚区域删除额外的结束div标签。