在Chrome或Firefox中无法正常运行.这有什么解决方法吗?
<!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>
Run Code Online (Sandbox Code Playgroud)
真实场景涉及绝对必须具有overflow-x:hidden的组件,但这将触发弹出菜单,这些菜单需要能够在y方向上脱离元素.我应该将这些菜单放在其父组件之外,还是有更好的解决方法?
Spr*_*tar 26
这可能与此处解决的问题有关:CSS overflow-x:visible; 溢出-y:隐藏; 导致滚动条问题
简而言之,当visible
用于其他任何一个overflow-x
或overflow-y
其他东西时visible
,该visible
值被解释为auto
.
我认为您可以通过额外的包装来获得您想要的东西,div
该包装可以隐藏但没有设置position: relative
(请参阅小提琴):
<div style="overflow-y:visible;width:100px;height:100px;position:relative;background:#666;">
<div style="overflow-x:hidden">
ooooooooooooooooooooooooooooooooooooooooooooooo
<div style="top:20px;left:20px; width:420px;height:420px;position:absolute;background:#420;">
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
23877 次 |
最近记录: |