首页 > 技术文章 > css 解决fixed 布局下不能滚动的问题

fuzitu 2018-08-14 11:20 原文

如果我们布局的是后是fixed并且想要高度为100%的时候,我们一般会这样设置:

 

 1  
 2 div {
 3  
 4     display:fixed;
 5  
 6     height:100%;
 7  
 8     overflow:scroll;
 9  
10 }

 


但是这样并不会出现滚动条,正确的做法应该设置top和bottom为0:

 

 
.fixed-content {

    top: 0;
 
    bottom:0;
 
    position:fixed;
 
    overflow-y:scroll;
 
    overflow-x:hidden;

 }

  

推荐阅读