Skip to main content
Home / Code Snippets / CSS / Force Vertical Scrollbar

Force Vertical Scrollbar

html {
  overflow-y: scroll;
}

This is invalid CSS, but it works in everything except Opera. The reason for this is to prevent "centering jumps" when navigating back and forth between pages with enough content to have a vertical scroll bar and pages that do not.