溢出:重叠在Firefox中不起作用 [英] Overflow: overlay doesn't work in firefox
问题描述
在我的网站上,我需要将CSS属性 overflow:overlay
用于< div>
.
On my website I need to use the css property overflow: overlay
for a <div>
.
但是,它没有在浏览器中呈现,并且对firebug中的css进行检查后发现它甚至不存在,但是它在Chrome中可以正常工作.我还没有测试过野生动物园.
However, it is not rendering in the browser and an inspection of the css in firebug shows that it isn't even there, but it is as it works in Chrome. I havn't tested out safari.
要使 overflow:overlay
css属性正常工作,我必须更改什么?
What must I change to get the overflow: overlay
css property working?
谢谢
推荐答案
可能的溢出值是:
visible
hidden
auto
scroll
请参见此处或
See here or here for a discussion of these.
在不同的浏览器中使用其他任何值都会产生不可预测的结果,因为它们对错误值的处理方式不同.
Using any other value in different browsers will yield unpredictable results as they handle the incorrect value differently.
Edit: Following the comment, I've managed to find mention of overflow:overlay here.
叠加层描述为:
内容被剪切,并在必要时添加滚动条.
Content is clipped and scroll bars are added when necessary.
重要的是,它还说只能在Safari或Chrome(即WebKit)中使用.
Importantly its also said only to work in Safari or Chrome (ie WebKit).
WebKit bugzilla上的此项目表明,对于这个世界来说,这个世界已经很久了任何情况下:
This item on WebKit bugzilla suggest it is not long for this world in any case:
WebKit当前具有专有的CSS溢出值,称为"overlay".据我所知,从阅读代码可以看出,它的工作原理与自动"完全相同.
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".
我们应该将其删除或将其重命名为"-webkit-overlay".
We should either remove it or rename it to "-webkit-overlay".
2016年3月更新
看起来像 overflow:overlay
并没有消失.有迹象表明它已进入标准.
Looks like overflow: overlay
hasn't gone away. There are signs of it working it's way into the standards.
overlay
和 auto
之间的区别仅在于滚动条将出现在页面内容的顶部,而不会导致其占用布局空间.
The difference between overlay
and auto
would only be that the scrollbars would appear over the top of the page content, and not cause it to take layout space.
请参见此处进行讨论.
这篇关于溢出:重叠在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!