Css
CSS Scrollbars Styling Module
相关链接
快照版本:W3C Candidate Recommendation Snapshot, 9 December 2021
用于控制内容区域是否滚动的规范见:CSS Overflow Module
内容简介
Scrollbars Styling 模块主要定义了用于控制滚动条的样式使用到的一些属性。在 Level 1 规范中,主要介绍了 scrollbar-color 和 scroll-width,分别用来控制滚动条的颜色和宽度。
主要相关三个使用场景:
- 改变滚动条颜色以适配页面视觉效果
- 使得在较小的滚动区域缩小滚动条宽度成为可能
- 提供自定义的滚动条,以代替默认滚动条
The primary purpose of this property is not to allow authors to chose a particular scrollbar aesthetic for their pages, but to let them indicate for certain small or cramped elements of their pages that a smaller scrollbar would be desirable.
scrollbar-color
This property allows the author to set colors of an element’s scrollbars.
Property | Value |
---|---|
Name | scrollbar-color |
Value | auto | <color>1 |
Initial | auto |
Inherited | yes |
scrollbar-width
This property allows the author to specify the desired thickness of an element’s scrollbars.
Property | Value |
---|---|
Name | scrollbar-width |
Value | auto | thin2 | none3 |
Initial | auto |
Inherited | yes |