简体   繁体   English

为什么滚动条不能在此水平DIV上工作?

[英]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>

display:none 不适用于我的<div> , 为什么?</div><div id="text_translate"><p> 我正在尝试使我的网站的一部分与移动设备兼容,因此想在较小的屏幕上从按钮选择菜单切换到下拉菜单。</p><p> 我的代码目前如下所示:</p><pre> <html> <head> <style>.reiter { background-color: rgba(250,250,250,1); position: fixed; top: 98px; height: 64px; width: 100%; z-index: 9; padding-top: 2px; }.switchbtn { border: 1px solid #282E34; background-color: rgba(250,250,250,1.00); color: #282E34; padding: 7px 14px; font-size: 16px; cursor: pointer; border-radius: 5px; border-color: #282E34; transition: all 0.3s; width: 12%; height: 60px; } @media screen and (min-width: 1000px) {.dropswitch {display: none;} } @media screen and (max-width: 1000px) {.reiter {display: none;} } </style> </head> <body> <div class="reiter"><center> <a href="#jumpup"><button id="schaltschrankbutton" class="switchbtn" type="button" onClick="openschaltschrank()">Steuerungs-<br>systeme</button></a> <a href="#jumpup"><button id="ledbandbutton" class="switchbtn" type="button" onClick="openledband()">Leucht-<br>lösungen</button></a> <a href="#jumpup"><button id="dimmerbutton" class="switchbtn" type="button" onClick="opendimmer()">Geräte &<br>Dimmer</button></a> </center></div> <select class="dropswitch"> <option value="1">Steuerungssysteme</option> <option value="2">Leuchtlösungen</option> <option value="3">Geräte & Dimmer</option> </select> </body> </html></pre><p> 下拉菜单完全按照它应该做的,它出现,当屏幕小和消失,当屏幕大。 不过,div 一点也不在乎。 我尝试添加@media screen and (min-width: 1000px) {.reiter {display: block;} } ,但这并没有改变任何东西。</p></div> - display:none won't work on my <div>, why?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的 HTML 水平滚动不起作用? - Why my HTML horizontal scroll won't work? 水平 iScroll 不起作用 - Horizontal iScroll Won't Work 滚动条到水平div - Scrollbar to horizontal div 挣扎着DIV的水平滚动条 - Struggling with horizontal scrollbar of a DIV DIV不显示水平滚动条 - DIV not displaying Horizontal Scrollbar 我的asp.net面板上的水平滚动条不会滚动 - The horizontal scrollbar on my asp.net panel won't scroll 为什么我的关键帧动画无法在div上工作? - Why won't my key frames animation work on my div? 为什么 HTML 链接不能在透明边框 div 内工作? - Why won't an HTML link work inside a transparent bordered div? display:none 不适用于我的<div> , 为什么?</div><div id="text_translate"><p> 我正在尝试使我的网站的一部分与移动设备兼容,因此想在较小的屏幕上从按钮选择菜单切换到下拉菜单。</p><p> 我的代码目前如下所示:</p><pre> <html> <head> <style>.reiter { background-color: rgba(250,250,250,1); position: fixed; top: 98px; height: 64px; width: 100%; z-index: 9; padding-top: 2px; }.switchbtn { border: 1px solid #282E34; background-color: rgba(250,250,250,1.00); color: #282E34; padding: 7px 14px; font-size: 16px; cursor: pointer; border-radius: 5px; border-color: #282E34; transition: all 0.3s; width: 12%; height: 60px; } @media screen and (min-width: 1000px) {.dropswitch {display: none;} } @media screen and (max-width: 1000px) {.reiter {display: none;} } </style> </head> <body> <div class="reiter"><center> <a href="#jumpup"><button id="schaltschrankbutton" class="switchbtn" type="button" onClick="openschaltschrank()">Steuerungs-<br>systeme</button></a> <a href="#jumpup"><button id="ledbandbutton" class="switchbtn" type="button" onClick="openledband()">Leucht-<br>lösungen</button></a> <a href="#jumpup"><button id="dimmerbutton" class="switchbtn" type="button" onClick="opendimmer()">Geräte &<br>Dimmer</button></a> </center></div> <select class="dropswitch"> <option value="1">Steuerungssysteme</option> <option value="2">Leuchtlösungen</option> <option value="3">Geräte & Dimmer</option> </select> </body> </html></pre><p> 下拉菜单完全按照它应该做的,它出现,当屏幕小和消失,当屏幕大。 不过,div 一点也不在乎。 我尝试添加@media screen and (min-width: 1000px) {.reiter {display: block;} } ,但这并没有改变任何东西。</p></div> - display:none won't work on my <div>, why? 为什么右侧的div启用水平滚动条? - Why does the div on the right side enable the horizontal scrollbar?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM