css隐藏滚动条但可以滚动

第一种方法添加伪类

   .container {
    
    
    width: 100%;
    // height: 208px;
    display: -webkit-box;
    overflow-x: scroll;
    box-sizing: border-box;

  }
   .container::-webkit-scrollbar {
    
    
      display: none;
    }

第二种方法(思路)

设置父容器overflow hiden postion relative
子容器 postion absolute 然后将滚动条溢出父容器,实现隐藏效果

猜你喜欢

转载自blog.csdn.net/qq_26889291/article/details/121038030