Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Always show browser scrollbar to prevent page jumping [duplicate]

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

like image 445
pab Avatar asked Sep 25 '12 12:09

pab


People also ask

How do I make my scrollbar visible all the time?

Make sure overflow is set to "scroll" not "auto." With that said, in OS X Lion, overflow set to "scroll" behaves more like auto in that scrollbars will still only show when being used.

How do I stop the scroll bar from moving in CSS?

The easy fix is to use width: 100% instead. Percentages don't include the width of the scrollbar, so will automatically fit. If you can't do that, or you're setting the width on another element, add overflow-x: hidden or overflow: hidden to the surrounding element to prevent the scrollbar.


1 Answers

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;  } 
like image 134
Oliver Millington Avatar answered Sep 21 '22 09:09

Oliver Millington