Resources: Code

Force vertical scrollbar with CSS

27 September 2012

I’ve often had clients wondering why their website seems to ‘bump’ from side to side when navigating between pages. When I eventually understand what they’re experiencing, it is when a scrollbar is not shown when the page is shorter than the browser’s window. This quick CSS code will make every page an extra 1px taller than the window it’s shown in, so permanently fixing a vertical scrollbar.

html, body {
height: 100%;
margin: 0 0 1px;
padding: 0;

Tags: , ,

Let's work together