css解决fixed布局不会出现滚动条的问题
如果我们布局的是后是fixed并且想要高度为100%的时候,我们一般会这样设置:
width
:
100%
;
height
:
auto
;
z-index
:
9999999
;
background
: #fff
;
padding-bottom
:
1rem
;
position
:
fixed
;
top
:
0
;
overflow-y
:
scroll
;
overflow-x
:
hidden
;
但是这样并不会出现滚动条,正确的做法应该设置top和bottom为0:
- .fixed-content {
- top: 0;
- bottom:0;
- position:fixed;
- overflow-y:scroll;
- overflow-x:hidden;
- }