Html 网站不会向下滚动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24246914/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:03:23  来源:igfitidea点击:

Website won't scroll down

htmlcssscroll

提问by Sophiaa

My website works on a 15 inch laptop, but whenever I resize the browser, some of the information on my website 'disappears', as I am unable to scroll (scrollbar won't appear).

我的网站在 15 英寸的笔记本电脑上运行,但是每当我调整浏览器的大小时,我网站上的一些信息就会“消失”,因为我无法滚动(不会出现滚动条)。

I'm experiencing this problem for two of my websites (they're part of a school project).

我的两个网站(它们是学校项目的一部分)遇到了这个问题。

On the first website, the sticky footer covers the content when the website is being viewed in a smaller browser window. I managed to get a scrollbar for the container part (everything except for the header and footer), but I need the scrollbar to appear on the very right side of the website, outside of the container. (only the footer will be fixed, the header will be scroll-able as well).

在第一个网站上,当在较小的浏览器窗口中查看网站时,粘性页脚会覆盖内容。我设法获得了容器部分的滚动条(除页眉和页脚之外的所有内容),但我需要滚动条出现在网站的最右侧,容器外。(只有页脚是固定的,页眉也可以滚动)。

http://sophisticateddesign.nl/cfreport/index.html

http://sophisticateddesign.nl/cfreport/index.html

On the second website, I need the header and butterfly to stay fixed and for everything else to be scroll-able.

在第二个网站上,我需要标题和蝴蝶保持固定,并且其他所有内容都可以滚动。

http://sophisticateddesign.nl

http://sophisticateddesign.nl

I'm wondering if there's an easy solution as I don't have much time left for these websites to finish..

我想知道是否有一个简单的解决方案,因为我没有太多时间来完成这些网站..

回答by Nick

Remove overflow: hiddenin html

overflow: hidden在 html 中删除

html {
  height: 100%;
  margin: auto;
  width: 960px;
}

Remove position: absolutefor .Wrapper

删除position: absolute.Wrapper

For second site: You added your main content inside headerwith position: fixed; height: 50px;. It's the problem.

对于第二个站点:您将主要内容添加headerposition: fixed; height: 50px;. 这是问题所在。

回答by dacastro4

You have these CSSproperties to your HTMLtag.

您的HTML标记具有这些CSS属性。

html{
    height: 100%;
    margin: auto;
    width: 960px;
    overflow: hidden;
}

Try changing overflowto overflow: scroll

尝试将溢出更改为溢出:滚动

回答by Anonymous

Yeah I just tried this out if you need something to overflow the sides you should use

是的,如果你需要一些东西来溢出你应该使用的边,我只是试过这个

html{
overflow-x: hidden;
}

instead of using just overflow.

而不是只使用溢出。

|| For anyone who encounters this problem in the future. ||

|| 对于将来遇到此问题的任何人。||