天天看点

CSS隐藏滚动条方法

css隐藏滚动条,网上浏览了一大堆方法,都是把宽度写死,不是我想要的,现给出自己的解决方案。

<style>
.o1{
     width: 300px;
     height:300px;    // o1的宽度高度随便写,甚至可以不写
     position:relative;
     overflow:hidden;
}
.o2{
    position:absolute;
    left:0;
    top:0;
    bottom:0;
    overflow-x:hidden;
    overflow-y:scroll;
    width:calc(5000% + 20px);
}
.content{
    width:2%;
}
</style>
<div class='o1'>
        <div class='o2'>
                  <div class='content'>
                  </div>
        </div>
</div>

           

继续阅读