问题描述
在Chrome或Firefox中无法正常使用。是否有任何解决方法?
Doesn't work properly in Chrome or Firefox. Is there any workaround to this?
<!DOCTYPE html>
<html>
<head></head>
<body>
<h3>overflow-y:visible</h3>
with overflow-x:hidden
<div style="overflow-x:hidden;overflow-y:visible;width:100px;height:100px; position:relative;background:#666;">
<div style="top:20px;left:20px; width:420px;height:420px;position:absolute;background:#420;">
</div>
</div>
without overflow-x:hidden
<div style="overflow-y:visible;width:100px;height:100px;position:relative;background:#666;">
<div style="top:20px;left:20px; width:420px;height:420px;position:absolute;background:#420;">
</div>
</div>
</body>
</html>
现实生活中的场景包含了绝对必须有overflow-x:hidden的组件,但会触发需要的弹出菜单以能够在y方向上从元件断开。
The real life scenario involves components that absolutely must have overflow-x:hidden, but that will trigger popup-menus that need to be able to break free from the element in y-direction. Should I just position those menus outside their parent components, or is there a better fix?
推荐答案
这可能与其中的父组件有关问题在这里:
This likely has to do with the issue addressed here: CSS overflow-x: visible; and overflow-y: hidden; causing scrollbar issue
总之,当使用 visible
-x 或 overflow-y
和可见
code> visible 值解释为 auto
。
In short, when using visible
for either overflow-x
or overflow-y
and something other than visible
for the other, the visible
value is interpreted as auto
.
这篇关于overflow-y:当overflow-x:hidden存在时,可见不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!