如果我们布局的是后是fixed并且想要高度为100%的时候,我们一般会这样设置:
width: 100%; height: auto; z-index: 9999999; padding-bottom: 1rem; position: fixed; top: 0; overflow-y: scroll; overflow-x: hidden;
但是这样并不会出现滚动条,正确的做法应该设置top和bottom为0:
width: 100%; height: auto; z-index: 99999999; padding-bottom: 1rem; position: fixed; top: 0; bottom: 0; overflow-y: scroll; overflow-x: hidden;
————————————————
以上就是css解决fixed布局不会出现滚动条的问题的解决方法。
新闻热点
疑难解答