我想在 Chrome 中有一个自定义滚动条。
所以,我正在使用这个 sass:
::-webkit-scrollbar {
width: 0.5em;
height: 0.5em;
}
::-webkit-scrollbar-thumb {
background-color: rgba(255,255,255,.1);
border-radius: 3px;
&:hover {
background: rgba(255,255,255,.2);
}
}
我的问题是我只想在特定的 div 中使用这种滚动条样式。但如果我这样做:
#boardslist {
::-webkit-scrollbar {
width: 0.5em;
height: 0.5em;
}
::-webkit-scrollbar-thumb {
background-color: rgba(255,255,255,.1);
border-radius: 3px;
&:hover {
background: rgba(255,255,255,.2);
}
}
}
不工作。有什么想法吗?
最佳答案
#boardslist {
&::-webkit-scrollbar {
width: 0.5em;
height: 0.5em;
}
&::-webkit-scrollbar-thumb {
background-color: rgba(255,255,255,.1);
border-radius: 3px;
&:hover {
background: rgba(255,255,255,.2);
}
}
}
关于html - 仅在一个 div 中自定义滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38023932/