Add Me!Close Menu Navigation
Add Me!Open Categories Menu

Always show the vertical scrollbar using CSS

The dynamic nature of today’s webpages results in content being added to and removed from the DOM on-the-fly. By adding content to a short page, your content can suddenly surpass the browser window height, which results in a vertical scrollbar being added. The problem is that this addition causes your content to jump horizontally as well, when the browser creates extra space for the vertical scrollbar. Easiest approach to overcome this, is to make sure that your verticall scrollbar is always in sight.

Here’s a simple CSS rule applied to your HTML, which will ensure that the vertical scrollbar is always on display.

html {
  overflow: -moz-scrollbars-vertical;
  overflow-y: scroll;
  overflow-x: auto;
}
Posted By Shahways Romani

Developer working on both the front & back-end side of the web. Consulting attitude, with an eye for marketing. Loves fresh coffee, and a good game of poker.

Leave a Reply