隐藏滚动条但是可以滚动
方法一、
<style>
* {
padding: 0;
margin: 0;
}
.container {
width: 1200px;
height: 500px;
margin: 0 auto;
background-color: #edeced;
position: relative;
overflow: hidden;
}
.container-inner {
position: absolute;
left: 0;
top: 0;
right: -17px;
bottom: 0;
overflow-x: hidden;
overflow-y: scroll;
}
</style>
<div class="container">
<div class="container-inner">
.......
</div>
</div>
方法二、
* {
padding: 0;
margin: 0;
}
.container {
width: 1200px;
height: 500px;
margin: 0 auto;
background-color: #edeced;
overflow: auto;
}
.container::-webkit-scrollbar {
width: 0 !important
}
.container {
/* IE 10+ */
-ms-overflow-style: none;
/* Firefox */
overflow: -moz-scrollbars-none;
}
<div class="container">
.....................
</div>
方法三、
* {
padding: 0;
margin: 0;
}
.container {
width: 1200px;
height: 500px;
margin: 0 auto;
background-color: #edeced;
position: relative;
overflow: hidden;
}
.content {
width: 1200px;
height: 500px;
}
.inner-container {
position: absolute;
left: 0;
overflow-x: hidden;
overflow-y: scroll;
}
/* for Chrome */
.inner-container::-webkit-scrollbar {
display: none;
}
<div class="container">
<div class="inner-container">
<div class="content">
...................
</div>
</div>
</div>
方法四、
* {
padding: 0;
margin: 0;
}
.scroll_content {
width: 1200px;
height: 500px;
margin: 0 auto;
background-color: #edeced;
position: relative;
overflow: auto;
}
/*webkit内核*/
.scroll_content::-webkit-scrollbar {
width: 0px;
height: 0px;
}
.scroll_content::-webkit-scrollbar-button {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-webkit-scrollbar-track {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-webkit-scrollbar-track-piece {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-webkit-scrollbar-corner {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-webkit-scrollbar-resizer {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-webkit-scrollbar {
width: 10px;
height: 10px;
}
/*o内核*/
.scroll_content .-o-scrollbar {
-moz-appearance: none !important;
background: rgba(0, 255, 0, 0) !important;
}
.scroll_content::-o-scrollbar-button {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-o-scrollbar-track {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-o-scrollbar-track-piece {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-o-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-o-scrollbar-corner {
background-color: rgba(0, 0, 0, 0);
}
.scroll_content::-o-scrollbar-resizer {
background-color: rgba(0, 0, 0, 0);
}
/*IE10,IE11,IE12*/
.scroll_content {
-ms-scroll-chaining: chained;
-ms-overflow-style: none;
-ms-content-zooming: zoom;
-ms-scroll-rails: none;
-ms-content-zoom-limit-min: 100%;
-ms-content-zoom-limit-max: 500%;
-ms-scroll-snap-type: proximity;
-ms-scroll-snap-points-x: snapList(100%, 200%, 300%, 400%, 500%);
-ms-overflow-style: none;
overflow: auto;
}
<div class="scroll_content">
.....................
</div>