微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – overflow-y:overflow-x:hidden存在时可见不起作用

参见英文答案 > CSS overflow-x: visible; and overflow-y: hidden; causing scrollbar issue5个
在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>

http://jsfiddle.net/sMNyK/

现实生活中的情况涉及绝对必须具有overflow-x:hidden的组件,但这将触发需要能够在y方向上从元素中释放的弹出菜单.我应该把这些菜单放在父组件之外,还是有更好的解决方案?

解决方法

这可能与这里解决的问题有关: CSS overflow-x: visible; and overflow-y: hidden; causing scrollbar issue

简而言之,当对于overflow-x或overflow-y使用visible可见,而对另一个使用visible时,可见值被解释为auto.

原文地址:https://www.jb51.cc/html/230938.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐