Content jumps horizontally whenever browser adds a scrollbar

后端 未结 6 1694
星月不相逢
星月不相逢 2021-01-04 03:28

I\'m using a fixed width body and auto margins to center my content in the middle of the page. When the content exceeds the page\'s height and the browser adds a scrollbar,

6条回答
  •  半阙折子戏
    2021-01-04 03:58

    Best possible way through CSS, It will show/hide Scrollbar accordingly, will solve jump problem, works on every browser

    html {
        overflow: hidden;
     }
    
    body {
        overflow-y: auto;
        -webkit-overflow-scrolling:touch;
    }
    

提交回复
热议问题