[英]Why won't the scrollbar work on this horizontal DIV?
So I read through the thread How to get Floating DIVs inside fixed-width DIV to continue horizontally? 因此,我通读了线程如何在固定宽度的DIV中获取浮动DIV以使其水平继续? and used pd.'s great answer to build a fixed-size DIV to contain inline elements that would scroll horizontally.
并使用pd。的绝佳答案来构建固定大小的DIV,以包含可水平滚动的内联元素。
It worked, it did exactly as I wanted... except the horizontal scrollbar doesn't actually work. 它工作了,它完全按照我的意愿工作了……只是水平滚动条实际上不起作用。 If I make the DIV's height 140px so that there's also a vertical scrollbar, then it works.
如果我将DIV的高度设置为140px,因此还有一个垂直滚动条,则它可以工作。 But when I make the diff tall enough to only have a horizontal scrollbar, it doesn't work!
但是,当我使diff足够高到只有一个水平滚动条时,它不起作用! It's racking my brain.
这真让我大吃一惊。 Here's the code:
这是代码:
<div style="height: 180px; width: 694px; margin: 0; padding: 0; overflow-x: auto; white-space: nowrap;">
<span style="width: 160px; height: 120px; background: rgba(255,255, 255, 0.9); display: inline-block; margin: 5px 0 5px 0;"></span>
<span style="width: 160px; height: 120px; background: rgba(255,255, 255, 0.9); display: inline-block; margin: 5px 0 5px 13px;"></span>
<span style="width: 160px; height: 120px; background: rgba(255,255, 255, 0.9); display: inline-block; margin: 5px 0 5px 13px;"></span>
<span style="width: 160px; height: 120px; background: rgba(255,255, 255, 0.9); display: inline-block; margin: 5px 0 5px 13px;"></span>
<span style="width: 160px; height: 120px; background: rgba(255,255, 255, 0.9); display: inline-block; margin: 5px 0 5px 13px;"></span>
</div>
If you'd like to look at the page directly, http://12for12boston.tumblr.com , PW: 12412. 如果您想直接查看页面,请访问http://12for12boston.tumblr.com ,密码:12412。
Thanks guys! 多谢你们!
A DIV (see below) is overlaying on top of the scrollbar, which is why the scrollbar is visible, but not functional. DIV(请参阅下文)覆盖在滚动条的顶部,这就是为什么滚动条可见但不起作用的原因。 Unsure as to what the purpose of the DIV is, but if you remove it works just fine.
不确定DIV的目的是什么,但是如果将其删除,则效果很好。
<div style="height: 50px; width: 960px; position: absolute; top:694px; left: 50%; margin-left: -480px;"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.