views:

908

answers:

1

In Firefox and Safari, pages that are centered move a few pixels when the page is long enough for the scrollbar to appear. If you navigate through a site that has long and short pages, the page seems to "jump" around.

IE7 tends to leave the scroll bar visible all of the time but disables it when the page is not long enough. Since the width of the HTML window never changes the centering of the page doesn't change.

Is there a workaround or a way to style the page so it doesn't jump around in Firefox and Safari?

Thanks.

+8  A: 

You could simply always enable the scrollbar:

html{
 overflow: scroll;
}

but that would give you the horizontal scrollbar too, this is better:

html{
   overflow-y:scroll;
   overflow-x:auto;
}

That will give you only the vertical scroll and the horizontal when needed.

Pim Jager