css 隐藏滚动条但不影响滚动

386 阅读1分钟
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css 隐藏滚动条但不影响滚动</title>
    <style>
        /* chrome去除滚动条IE10+ */
        .inner-container::-webkit-scrollbar {
            display: none;
        }
        .outer-container{
            width: 36px;
            height: 20px;
        }
        .inner-container{
            overflow-x: scroll;
            /*overflow-y: ;*/
        }
        .inner-container {
            /* IE去除滚动条IE10+ */
            -ms-overflow-style: none;
            /* 火狐 */
            scrollbar-width: none;
        }
    </style>
</head>
<body>
<div class="outer-container">
    <div class="inner-container">
       123456789123456789123456789
    </div>
</div>

</body>
<script>
</script>
</html>