sascha
sascha

Reputation: 4690

Scrolling in Webkit / mozilla while overflow is hidden

Is there a way to tell Safari / Webkit browsers and Firefox to scroll an element or a page while overflow is set to "hidden"?

I'm using overflow: hidden on the body-Element and it works for Opera only.

Any ideas?

Upvotes: 0

Views: 1935

Answers (3)

webinista
webinista

Reputation: 3764

Pretty sure this is one of those cases where Opera does it differently from everyone else. Overflow is supposed to prevent scrolling if its value is hidden, not just hide scroll bars.

If you really want to hide the scroll bars, but still want to scroll the window or its contents, you can use JavaScript / DOM script to do it.

Upvotes: 2

Phil Powell
Phil Powell

Reputation: 424

If you're setting overflow: hidden on any element, you're explicitly telling it that the contents should be hidden, and therefore can't be scrolled to. If you want the contents to be scrollable, then you need to use overflow: auto. Why would you ever want to scroll something you're telling the browser it should not scroll? It's contradictory.

Upvotes: 0

Jack Billy
Jack Billy

Reputation: 7211

Sorry but you have been mistaken, the overflow-x:hidden or overflow-y:hidden must be applied to the html element, not body element. But in just the case I have googled it and found these link tell me if they did any help.

http://www.webmasterworld.com/javascript/3560359.htm

http://www.artmov.com/dev/snippets/apply-overflow-x-overflow-y-to-body-in-ie7-ie6-84/ (In this link I found the above mentioned statement.)

http://haslayout.net/css/Document-Scrollbars-Overflow-Inconsistency

In this link I found that you should apply directly overflow value in the <HTML> tag.

Hope it works!

Upvotes: 0

Related Questions