Removing scroll pages in IE8 (overflow: hidden not working)

Application of this

overflow:hidden; 

in the body of my document does not affect IE8. Any ideas why?

+3
css internet-explorer-8
source share
3 answers

This depends on whether IE8 displays the page in Quirks standard or mode. For example, the following HTML will display without a scrollbar:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <title>test</title> </head> <body> <p>hello</p> </body> </html> 

But if you remove the doctype declaration, IE8 will display the page in Quirks mode:

 <html> <head> <title>test</title> </head> <body> <p>hello</p> </body> </html> 

You can also check this by forcing the rendering mode using the developer tools. Press F12 on the page, and at the end of the menu bar (for some reason ...) the "Document Mode" parameter will appear. Switching between standards and Quirks here should also switch the scroll bar.

So ... you need your page to adhere to the HTML standard! It doesn't have to be XHTML Strict, it could be HTML 4 or even XHTML Transitional, if you really should.

W3C Validator can help you with any validation errors.

+5
source share

It must be something else, because I just applied overflow: hidden on this HTML element of the stackoverflow page, and the scroll bar disappeared.

Could you post some more css or code?

Edit: I also tried it on the body element, and it also worked .. there is no longer a scroll bar.

+2
source share

add this IE hack:

  max-height: none\9 
0
source share

All Articles