Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

On my website I need to use the css property overflow: overlay for a <div>.

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.

What must I change to get the overflow: overlay css property working?

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
859 views
Welcome To Ask or Share your Answers For Others

1 Answer

Possible values for overflow are:

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.

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".

Update March 2016

Looks like overflow: overlay hasn't gone away. There are signs of it working it's way into the standards.

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.

See here for the discussion.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...