问题描述
::-webkit-scrollbar{
height:0px
width:0px;
}
// hides both vertical and horizontal scrollbar
如何使用它仅隐藏垂直或水平方向?不是两个方向
我想隐藏垂直滚动,但仍然可以使用,溢出隐藏功能会禁用滚动
解决方法
这是隐藏滚动条的解决方案
html {
scrollbar-width: none; /* For Firefox */
-ms-overflow-style: none; /* For Internet Explorer and Edge */
}
html::-webkit-scrollbar {
width: 0px; /* For Chrome,Safari,and Opera */
}
html
可以替换为要隐藏其滚动条的任何元素。
over-flow: hidden;
overflow-x: auto;
和
over-flow: hidden;
overflow-y: auto;
,
在-webkit-scrollbar
中,width
值用于竖线,height
值用于水平线。
html::-webkit-scrollbar {
width: 5px;
height: 0px; /* If value is 0px,the horizontal bar will disappear but still works*/
}