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>