css中overflow:overlay的特性

我在chrome的css调试器中看到有这个属性,测试了之后只有这个属性满足我的需求,可以忽略掉滚动条的宽度

查了CSS文档,也没有看到这个overlay的介绍,google了也没有相关资料

我测试了几个浏览器,safari,chrome都是可以兼容的

有谁清楚这个overflow:overlay吗?请介绍一下,感激不尽

阅读 28.4k
4 个回答

overlay is described as:

Content is clipped and scroll bars are added when necessary.
Importantly its also said only to work in Safari or Chrome (ie
WebKit).

This item on WebKit bugzilla suggest it is not long for this world in
any case:

WebKit currently has a proprietary CSS overflow value called "overlay"
which is undocumented and as far as I can > tell from reading the code
works exactly like "auto".

We should either remove it or rename it to "-webkit-overlay".

Overflow: overlay doesn't work in firefox

overflow:auto
overflow:overlay

我觉得这样可以的,如果overlay有效会使用它,如果不支持,会使用auto

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题