RE: Proposal for a scrollbar-safe width calculation

> Use case 1: Centered web page
> Very many web pages are horizontally centered using a container element
> that has the left and right margins set to "auto". Usually, they suffer
> from a horizontal jump of 8px when navigating between pages that have a
> vertical scrollbar or not. In my authoring practice, I had several
> discussions on this effect with clients or designers who demanded the
> page to stay in it's place regardless of the amount of content. Anyway,
> after I suggested to force scrollbars, they accepted the jump as the
> lesser evil (still considering it as an evil).

Maybe you'll be interested to know how I fixed the issue on my own blog (http://fremycompany.com/BG).

I forced the scrollbar to appear all the time with "overflow-y: scroll" and then I styled the scrollbar. Styling the scrollbar is possible in IE (all versions) and Webkit (all recent versions), which represent a vast majority of users. For the FireFox and Opera users, the scrollbar appears all the time in its default styling which isn't that of an issue. 

Naturally, that works best because the scrollbar background is a solid color and that I use the exact same uniform color for my page background, so the scrollbar is nearly invisible. 		 	   		  

Received on Friday, 25 January 2013 22:42:16 UTC