css 实现移动端横向滚动效果(无滚动条)

css 实现移动端横向滚动效果(无滚动条)

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style>
            .scroll{
                width:auto;
                white-space: nowrap;
                overflow-y: hidden;
                overflow-x: scroll;
            }
            .scroll::-webkit-scrollbar{ // 隐藏滚动条
                display: none;
            }

            .box {
                display: inline-block;
                width: 400px;
                height: 100px;
                background-color: #555;
                margin-right: 20px;
            }
        </style>
    </head>
    <body>
        <div class="scroll">
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
        </div>
    </body>
</html>
上一篇:解决高度塌陷的几种方法


下一篇:overflow