views:

557

answers:

3

My page is a 3 column design with a header. It renders nicely in IE6 and IE7 (as far as i know). I use javascript to size certain elements of the page, to fit the browser window. On IE8 however, it tries to leave spaces for scrollbars, even when they are not rendered, resulting in a jumping effect when you resize (Page alternates between leaving the gap, and then not.)

If i set overflow:scroll in my css it resolves the issue, however i do not want the scrollbars to show when not needed, so this is only a temporary fix.

Is there any way i can get my page to stretch to maximum width and height (with javascript) and only get scrollbars when needed?

+2  A: 

I think you have your thinking reversed now that I've thought about it more.

IE7 and below always showed the scrollbar (disabling it if its not needed). So, when scrolling is needed, the UI doesn't need to be altered to enable/disable scroll.

Since IE8 this is no longer true. When scrolling is needed, the page jumps to accomidate the new needed space for the scrollbar. The same is true for any browser that doesn't show the scrollbar by default.

If you set overflow:scroll on the body you will make all browsers show the scrollbar by default and it should prevent the jumping.

Kevin Peno
like i mentioned, i have it set to overflow:scroll already. the fact is i don't want the horizontal scrollbar there, nor the vertical unless needed. ie8 was leaving the gap but not showing the scrollbar. it's fine though, i have settled for overflow:scroll for now. +1 for the help :)
moonblade
A: 

You can always add overflow-x: hidden to inhibit the horizontal scrollbar. When paired with overflow: scroll, it will do what you want with the horizontal scrollbar.

The vertical scroll bar will remain visible, but it will be disabled.

Jonathan Abbey
A: 

Width=100% not working in IE8 .. especially for tables

http://www.velocityreviews.com/forums/t691164-table-100-and-horizontal-scrollbar-why.html

Instead try to use width=99% or 98%

Hemant Tank