HTML | CSS | Tutorials

David Carr

Avoiding pageshift by forcing a scrollbar with CSS

I've had a few people ask me about the same problem recently its a simple problem with a simple solution.

Ever noticed your page shift when using a central container when moving from page to page? chances are you have and the reason for this in most cases is due to some pages not having enough content for the browser to create a scrollbar and other pages having enough content so when moving pages the central container will adjust itself to be in the center of the available space, this can cause a slight shift on position.

The solution is to either have enough content to make a scrollerbar not an ideal solution its much easier to add a tiny bit of CSS to your stylesheets to force a scrollbar then you never need worry about the page shifting vertically.

html>body { overflow:scroll; }

That will force the browser to ensure there is always a scrollbar visible.

Domains are often purchased from multiple providers, keeping track of where a domain is and its DNS settings can be tricky. Domain Mapper solves this by listing all your domains in one place. View your DNS settings and receive reminders to renew your domains. Try it today.

Support my work by donating with PayPal.

Subscribe to my newsletter

Subscribe and get my books and product announcements.

© 2009 - 2021 DC Blog. All code MIT license. All rights reserved.