CSS:全尺寸 div 显示浏览器滚动条

发布于 2024-08-04 15:19:05 字数 619 浏览 2 评论 0原文

我有一个网站需要在浏览器窗口中完全独立,即用户不必上下滚动即可查看网站的不同部分。太长而无法放入内容窗格的内容可以使用 Overflow:auto 进行处理,效果很好。

问题是,无论我尝试什么,我仍然遇到以下问题:

两组滚动条 http:// www.wikiforall.net/bad_scrollbars.png

因此,在成功填充浏览器窗口的内容下方,似乎存在一个间隙。这个间隙导致垂直滚动条显示出来(并且右侧似乎有一个类似的间隙,但不太容易看到)。我已经使用 Chrome 的元素检查器检查了这些元素,并且 标记仅覆盖了该间隙。所以我不知道差距从何而来。

主页 div 设置为 position:absolute,左、右、上、下均设置为零。这些 div 还设置了 display: inline,并且没有边距或填充。 htmlbody 标记的样式相同。

我已经四处寻找了一两天,但没有发现任何效果。有谁知道如何删除这些滚动条?

I have a site which needs to be fully self-contained in the browser window, ie, the user must not have to scroll up and down to view different parts of the site. Content that is too long to fit into the content pane is handled with overflow:auto, which is working fine.

the problem is, no matter what I try I still have the following problem:

two sets of scrollbars http://www.wikiforall.net/bad_scrollbars.png

So beneaht the content which successfully fills the browser window, there seems to be a gap. This gap causes the vertical scrollbar to show itself (and there appears to be a similar gap on the right side which isn't as easy to see). I've inspected the elements using Chrome's element inspector and the <html> tag covers only up to that gap. So I have no idea where the gap is coming from.

The main page divs are setup with position: absolute, with left, right, top, and bottom all set to zero. These divs also have display: inline set, and do not have margins or padding. The html and body tags are styled the same way.

I've been looking around for a day or two but nothing I've found has worked. Does anyone know how to remove these scrollbars?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

好听的两个字的网名 2024-08-11 15:19:05

您始终可以使用:

overflow: hidden;

隐藏滚动条。

You can always use:

overflow: hidden;

To hide the scrollbars.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文