Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browser Scrollbar shift

When you go to page on my website where there is extra content, the scrollbar appears on the right, but it has a notiable shift to the left for my content. You notice this by clicking home and then hosting and back again on my site (www.ipalaces.org)

How can I account for the browser scrollbar on my pages? Can I make it so the scrollbar is always visible atleast?

My website is www.ipalaces.org, please let me know.

like image 547
ParoX Avatar asked Jul 29 '09 22:07

ParoX


People also ask

How do I customize my browser scrollbar?

Scrollbar Selectors For webkit browsers, you can use the following pseudo elements to customize the browser's scrollbar: ::-webkit-scrollbar the scrollbar. ::-webkit-scrollbar-button the buttons on the scrollbar (arrows pointing upwards and downwards). ::-webkit-scrollbar-thumb the draggable scrolling handle.

How do I change the scroll bar in Chrome?

Left-click and drag the small circle on the Scrollbar thumb color palette to select a color there. You can also choose different shades for your selected color by dragging the HSV bar sliders up and down. Drag the circle within the Scrollbar track color palette to choose a color for the track bar.

How do I stop scrollbar from moving?

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.


2 Answers

Well, it depends on the browser.

body {

overflow-y: scroll;
overflow-x: scroll;
overflow: -moz-scrollbars-vertical;

}

Should force the horizontal (overflow-x) and vertical scrollbars (overflow-y) to be displayed. Though I recall that Opera sometimes fails to respect the declaration, unless it's on an element within the <body> (divs and the like).


Edited with regard to @wsanville's, and @BHare's, comment.

like image 186
David Thomas Avatar answered Sep 24 '22 03:09

David Thomas


I've tested this on IE6, IE7, IE8, Firefox 3, and Chrome, and the simple way to have a vertical scroll bar always visible is simply:

html { overflow-y: scroll; } 
like image 27
wsanville Avatar answered Sep 22 '22 03:09

wsanville