Vertical scrollbar position Absolute

Is there a way to have a vertical scrollbar in a transverse browser with an absolute position?

My problem is that the scrollbar changes the width of my site when it appears, asking some problems in my layout.

I don’t want to delete it, I just want its width to not interfere with my layout.

Thanks!

0
source share
3 answers

To stop the layout from moving when a scrollbar appears, you can use the css below to always see your scrollbar.

html{ overflow-y: scroll; } 
+3
source

Only in Safari and Chrome (i.e. Webkit) can you also use:

 html{ overflow-y: overlay; } 

It will add a scrollbar only if necessary and place it above your content, which means that it will not damage your layout. Use with caution, although it is proprietary and undocumented.

+3
source

always display it so as not to interfere with your layout. this is what google does;)

+1
source

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


All Articles