Web pages move if windows has to add a scroll bar on long pages. Workaround ?
Posted on 2011-09-12
I am working on a website for a friend, and I have basic knowledge of css & html. I want all of the pages to be anchored in the exact same spot (left to right, and distance from the top). They are all based on the same Dreamweaver template. The problem that I have (which I admit is pretty nitpicky) is that when any of the pages are too long to fit vertically on the screen, Windows adds scrollbars on the right side of the screen display so that the user can scroll down to see the entire webpage. That shifts the longer pages to left by a width 1/2 of the scrollbars because my left and right margins are set to auto, and the Windows scrollbars decrease the available screen width.
I like having the padding set to auto so that it is easy to center the page for any screen resolution, but maybe there is a way to get the screen resolution, then calculate what a fixed left margin would be so that the pages would appear to be always in the middle and not move even if the scrollbars appeared on the long pages and reduced the screen width by a bit.... Or maybe there is another way.
Is there something cool and easy that I could do to get around this, or is it more trouble than it is worth ?