My site has both very short and longer pages. Since I center it in the viewport with margin: 0 auto
, it jumps around a few pixels when switching from a page that has a scrollbar to one that hasn't and the other way around.
Is there a way to force the vertical scrollbar to always appear, so my site stays put when browsing it?
Give your body
tag an overflow: scroll;
body {
overflow: scroll;
}
or if you only want a vertical scrollbar use overflow-y
body {
overflow-y: scroll;
}