It's our wits that make us men.

使tab切换不会因为出现滚动条使页面抖动

Posted on By Wei Bin

方法1:直接 html {height: 100%; margin-bottom: 1px; }
或者body { overflow-y: scroll;}
缺点:页面会默认有滚动条的槽

完美解决方案:

html {
                overflow-y: scroll;
                }

                :root {
                overflow-y: auto;
                overflow-x: hidden;
                }

                :root body {
                position: absolute;
                }

                body {
                width: 100vw;
                overflow: hidden;
                }