移动端隐藏X轴滑动条

移动端隐藏X轴滑动条

步骤

  • 子元素设置高度,设置不换行属性 white-space: nowrapoverflow-x: scroll;
  • 父元素设置高度,高度小于子元素,让子元素将父元素高度撑开。设置css属性 overflow-x: scroll;

 代码演示  》ul左右滑动 不显示X轴滚动条

.miaosha-content{
    width: 100%;
    overflow: hidden;
    height: 110px;   /*超出高度,隐藏滑动*/
    .miaosha-content-ul{
        width: 100%;
        margin: 5px 0px;
        padding: 0px;
        overflow-x: scroll;
        white-space: nowrap;
        height: 115px;
        li{
            display: inline-block;
            width: 70px;
            height: 60px;
            margin-right: 10px;
            text-align: center;
        }
    }
}

猜你喜欢

转载自blog.csdn.net/qq_38880700/article/details/106911184