Html 滚动条不出现?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18688423/
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 13:10:02  来源:igfitidea点击:

Scroll bar not appearing?

csshtmlscrollbartumblr

提问by Peter Stirrup

I'm developing a theme for Tumblr and the scrollbar isn't appearing for some reason? This is the url for the blog.

我正在为 Tumblr 开发一个主题,但由于某种原因没有出现滚动条?这是博客的网址。

The code for the theme can be found on the page source from the right click (all but the html as it gets messed up by Tumblr filling in the {}blanks)

主题的代码可以通过右键单击在页面源代码中找到(除了 html,因为它被 Tumblr{}填空了)

<body>
<div id="titlebox">
<div id="title"><b>{Title}</b><div>
{block:IfHeaderImage}<img src="{image:Header}" class="avatar"/>{/block:IfHeaderImage}
<div id="description">{Description}</div>
{block:Pages}{block:HasPages}<div id="pages"><a href="{URL}" class="pagelabel">{Label}</a><br></div>{/block:HasPages}{block:Pages}
</div>
</div>
<div id="postholder">
{block:Posts}
<div id="post">
{block:Photo}<a href="{Permalink}"><img src="{PhotoURL-400}" alt="PhotoAlt" class="photo"></a>{/block:Photo}
{block:Text}{block:Title}{Title}{/block:Title}{Body}{/block:Text}
</div>
{/block:Posts}

回答by logan

Try:

尝试:

body {
    overflow:auto;
}

回答by grepit

The theme is in a way the the height is small therefore the scroll bar disappears. If you have to have a scroll bar try this by adding it under the <style type="text/css">tag :

主题在某种程度上高度很小,因此滚动条消失了。如果您必须有滚动条,请尝试将其添加到<style type="text/css">标签下:

html {
    height: 110%;
    margin-bottom: 0.01em;
}

enter image description here

在此处输入图片说明

回答by mhd031

There's a few funny things going on here.

这里发生了一些有趣的事情。

'sidebar' has position 'fixed', which prevents the any new content from being seen even with overflow: auto.

'sidebar' 的位置是 'fixed',这可以防止任何新内容被看到,即使有溢出:自动。

What you can do is remove position: fixed from 'sidebar' and 'postholder'. give 'postholder' overflow: scroll and set body's overflow: auto to hidden (this removes the second scrollbar)

您可以做的是从“侧边栏”和“postholder”中删除位置:固定。给“postholder”溢出:滚动并将正文的溢出:自动设置为隐藏(这将删除第二个滚动条)

回答by Moftah

    html, body{
      overflow:initial !important;
    }