如何使⽤CSS隐藏滚动条并且兼容⼤部分浏览器隐藏滚动条,已经⾃⼰实测在浏览器Chrome, IE (6+), Firefox, Opera, Safari。
如下demo:
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
css去掉滚动条Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
<html>
<head>
<style>
.element,
.outer-container {
width: 200px;
height: 200px;
}
.outer-container {
/* border: 5px solid purple; */
position: relative;
overflow: hidden;
}
.inner-container {
position: absolute;
left: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.inner-container::-webkit-scrollbar {
.inner-container::-webkit-scrollbar {            display: none;
}
</style>
</head>
<body>
<div class="outer-container">
<div class="inner-container">
<div class="element">
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
<div>Content 1</div>
</div>
</div>
</div>
</body>
</html>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。