无法向下滚动以查看页脚

Cant scroll down to see footer

本文关键字:滚动      更新时间:2023-09-26

我是一名(荷兰)一年级学生,学习信息通信技术和媒体设计,我们正在使用HTML/CSS/JavaScript。

在为自己创建一个使用javascript、html和css的页面时,我偶然发现了一些问题。

我不能向下滚动以在页面的页脚上看到我的脚。我很确定我在固定位置上做错了什么,但我似乎找不出到底是什么。

希望你们能帮助我,可能有更多的错误定位明智。

提前谢谢你。

http://athena.fhict.nl/users/i299291/WP21/index.html(学校服务器)

您的页脚没有出现,因为您使用了不必要的使用位置。从CSS中删除所有的position:fixedposition:absolute,然后页面将可滚动,您可以看到您的页脚。

这是更新后的CSS;你可以看到所有的位置都被注释了,不需要使用它们。

#header {
    margin-left: auto;
    margin-right: auto;
    margin-top: 15px;
    position: relative; /* remove this line*/
    width: 100%;
}
#menubar {
    background-color: #2C2C2D;
    border: 1px solid #FFFFFF;
    height: 51px;
    line-height: 20px;
    margin: 261px auto 0; /* remove this line*/
    position: absolute; /* remove this line*/
    text-align: center;
    vertical-align: middle;
    width: 1280px;
}
#containerIndex {
    background-color: #FFFFFF;
    height: 530px;
    margin-top: 330px;
    opacity: 0.5;
    position: fixed; /* remove this line*/
    width: 1280px;
}
#footer {
    background-color: #C6C7C0;
    border: 1px solid #FFFFFF;
    height: 48px;
    line-height: 50px;
    margin: 880px auto 10px;/* remove this line*/
    position: fixed;/* remove this line*/
    text-align: center;
    vertical-align: middle;
    width: 1280px;
}

你的页脚有一个固定的位置。它显示在你的内容后面。去掉它,你就可以向下滚动到页脚了。