Samuel Page Digital Playground & Blog

1Jan/101
forcing-vertical-scroll-bars-in-firefox

Forcing vertical scroll bars in Firefox

Posted by Samuel Page

By default Firefox doesn't have the vertical scroll bar visible unless the page requires it.

On site where some pages need the scroll bar, but others don't this can make centered content appear to jump slightly to the left / right as the scroll bar is introduced and taken away.

Here's a nice CSS trick to force Firefox (and other browsers) to always show the scroll bar, even if it isn't required:

html {overflow-y:scroll;}

It's worth noting that this will prevent your CSS from validating - W3C returns the following message:

Property overflow-y doesn't exist in CSS level 2.1 but exists in : scroll scroll

Credit goes to http://freizl.blogspot.com/2008/01/force-vertical-scroll-bar-in-firefox.html