css 滚动条隐藏 内容区滚动
方法一、 兼容所有浏览器。
//css代码
.nav_wrap{
height: 400px;
width: 200px;
overflow: hidden;
border: 1px solid #ccc;
margin: 20px auto;
}
.nav_ul{
height: 100%;
width: 220px;
overflow-y: auto;
overflow-x: hidden;
}
//html代码
<div class= "nav_wrap">
<ul class= "nav_ul">
<li class="nav_li">测试</li>
<li class="nav_li">测试</li>
<li class="nav_li">测试</li>
<li class="nav_li">测试</li>
</ul>
</div>
方法二、兼容性不大好,对火狐不起作用
/*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);
}
/*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;
}