Forum Moderators: not2easy

Message Too Old, No Replies

Remove IE unused body vertical scrollbar?

I know this can be done via CSS...

         

JAB Creations

5:37 pm on Aug 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



IE ALWAYS displays the vertical scrollbar even if it's not being used. I find this obnoxious but I can't find the code via CSS to remove it that I once had,

createErrorMsg

6:22 pm on Aug 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know this can be done via CSS

Can't be done with CSS, but it can be done. Set the scroll attribute in the body element to "auto" and IE displays the scrollbar only when necessary.

Scroll, however, is an IE proprietary attribute [msdn.microsoft.com] and will throw an error in the validator. One way around this is to use JS to detect IE and add it on the fly (document.body.scroll='auto'). There is not, however, any pure CSS way to control this attribute.

cEM

birdbrain

6:57 pm on Aug 21, 2005 (gmt 0)



Can't be done with CSS,

Well, almost IE will render...

<body style="overflow:auto">

...in quirks mode. ;)

But, of course, the disadvantage of not using a DOCTYPE
is not overweighed by having no scrollbar in IE, is it. :)

birdbrain

JAB Creations

7:21 pm on Aug 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CEM's example works but of course I wanted this to at least validate.

MSIE is a legacy browser and therefor I do not care if it is running in standards or quirks mode just so long as it works. I'm sure many people feel the same about Netscape 4?

I set the overflow to auto as a proper XHTML document should first declare XML since XHTML is a subset of XML.

The only other way to do this which would not balance a centered effect anyway would be to use IE conditional comments to set the scrollbar colors to all be the same as the body bg color but I did not want the scrollbar rendering whatsoever.

Thanks to both of you!