Always show browser scrollbar to prevent page jumping

pab picture pab · Sep 25, 2012 · Viewed 44.2k times · Source

Possible Duplicate:
How to always show scrollbar in browser using javascript?

Some pages I have have lots of content other pages have a few lines, so when I am clicking between pages some pages have a scrollbar on the browsers and others don't. Because of this the page jumps all the time due to the extra space when clicking between pages.

Is it possible to have the scrollbar visible at all times, or greyed out if there is not a lot of content to stop the jumping of pages?

Can it work across all browsers, hope someone can help,

Cheers

Answer

Oliver Millington picture Oliver Millington · Sep 25, 2012

Try reading this article by Chris Coyer, it explains it pretty well.

From the article:

Assigning overflow-y to scroll does work, and it works in Firefox, Safari, and IE 6, and that makes it the best solution:

html {
    overflow-y: scroll; 
}