How to prevent page content from moving when scrolling appears?

I am currently working on a project on car travel http://wayfi.ru and

Recently, I ran into a problem - the contents of the page are shifted to the left after the appearance of vertical scrolling. How to prevent this?

As I know, you can always display a disabled scroll and activate it if necessary.

Do you know what is best for this?

+6
source share
1 answer

I am afraid that I do not know of any other way to do this, except to always show the scroll bar, active or not.

The easiest way:

html { overflow-y: scroll; } 

This way, even on non-scroll pages, there is space reserved for the scroll bar, and the content will not move between pages.

+6
source

Source: https://habr.com/ru/post/894700/


All Articles