CSS 实现隐藏滚动条同时又可以滚动内容

NARUTOLUOLUO 2019-11-17

<div class="outer_div">
   <div class="inner_div">
      <div>我是内容</div>
   </div>
</div>
.outer_div {
  position: relative;
  overflow: hidden;
  width: 200px;
  height: 200px;
}
.inner_div {
  position: absolute;
  left: 10px;
  right: -20px;
  top: 0;
  bottom: 0;
  overflow-x: hidden;
  overflow-y: scroll;
}

ok,有了以上的代码就可以轻松的实现效果啦!

相关推荐