如何在css中使用溢出时隐藏或删除滚动边栏?
我有一个burger类,我想使用如何在css中使用溢出时隐藏或删除滚动边栏?,css,Css,我有一个burger类,我想使用overflow属性来滚动。但当我使用它时,它看起来是这样的: 我希望有那种滚动效果,但同时,我不希望那些滚动条出现在侧面: 这是我的css类: .Burger { width: 100%; margin: auto; height: 250px; text-align: center; overflow: scroll; font-weight: bold; font-size: 1.2rem; }
overflow
属性来滚动。但当我使用它时,它看起来是这样的:
我希望有那种滚动效果,但同时,我不希望那些滚动条出现在侧面:
这是我的css类:
.Burger
{
width: 100%;
margin: auto;
height: 250px;
text-align: center;
overflow: scroll;
font-weight: bold;
font-size: 1.2rem;
}
有人知道我还可以在这些属性中添加什么来隐藏那一边的滚动条吗。我想让情感出现,但不是酒吧,就像这样:
隐藏滚动条但保持滚动 将此添加到您的代码中
/* Hide scrollbar for Chrome, Safari and Opera */
.Burger::-webkit-scrollbar {
display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.Burger {
overflow-y: scroll; /* Add the ability to scroll */
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
你也看到了吗
以及的浏览器兼容性
试试这个我想如果这是你想要的
可以将溢出设置为自动,而不是滚动。
.burger{
overflow: scroll; /* Add the ability to scroll */
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
/* Hide scrollbar */
.burger::-webkit-scrollbar {
display: none;
}