Forcing the browser scroll bar?


I have the feeling there’s a simple way to do this, but I don’t know how. IE does it, but not any of the good browsers.

I’m looking at a site design w/a very short home page. Subsequent pages will have more content and will be 3 times as long. All pages will be centered with margin: 0 auto and a fixed width like 900px.

When you do something like that, there’s no browser scroll bar on the home page, just the rest of the pages. That causes the content to jump left about 1opx when you leave the home page and 10px to the right when you go back. That looks like a mess. IE throws a dummy browser scroll bar (just the track w/no slider) on the home page and therefor avoids the jumpiness.

Is there a way to make all other browsers do that too, and not jump around horizontally?

Thanks guys.

html overflow-y scroll should do.

Thanks Eric! I knew it was simple (if you know the answer) :wink:

Your welcome. Note, that will give you a dummy horizontal scrollbar in Opera as well. You can also use the below code to do it, but if I remember correctly it caused some obscure problem in Safari with a 100% high footer. Or if the padding-bottom 1px was on the wrapper - don’t remember?

html {
body {

Hi Eric,
Yeah that was what I always disliked about html{overflow-y:scroll} but I always let Opera have it anyway.

I just checked one of my demos that uses that and it looks fine in Opera 10.10

I guess they finally resolved the problem. :slight_smile:

Oh good - now it’s fullproof!