From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/css/css_scrollbars/index.html | 86 +++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 files/zh-cn/web/css/css_scrollbars/index.html (limited to 'files/zh-cn/web/css/css_scrollbars') diff --git a/files/zh-cn/web/css/css_scrollbars/index.html b/files/zh-cn/web/css/css_scrollbars/index.html new file mode 100644 index 0000000000..0c2c9659f3 --- /dev/null +++ b/files/zh-cn/web/css/css_scrollbars/index.html @@ -0,0 +1,86 @@ +--- +title: CSS Scrollbars +slug: Web/CSS/CSS_Scrollbars +translation_of: Web/CSS/CSS_Scrollbars +--- +
{{CSSRef}}{{SeeCompatTable}}
+ +

CSS Scrollbars标准化了由ie5引入的废弃的滚动条颜色属性

+ +

基础例子

+ +

在这个例子里 我们选择使用一个比较细的 滚动轨道为绿色,滚动块为紫色的滚动条

+ +
+
.scroller {
+  width: 300px;
+  height: 100px;
+  overflow-y: scroll;
+  scrollbar-color: rebeccapurple green;
+  scrollbar-width: thin;
+}
+ +

HTML

+ +
<div class="scroller">
+Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi
+welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic.
+Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette
+tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato.
+Dandelion cucumber earthnut pea peanut soko zucchini.
+</div>
+ +

Result

+ +

{{EmbedLiveSample("Example")}}

+
+ +

Reference

+ +

CSS Properties

+ +
+ +
+ +

Specifications

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName("CSS Scrollbars")}}{{Spec2("CSS Scrollbars")}}Initial definition.
+ +

Accessibility concerns

+ +

When you customize scrollbars, consider they have enough contrast and that their hit area is large enough for people who use touch input.

+ + + +

Browser compatibility

+ + + +

scrollbar-width

+ +
{{Compat("css.properties.scrollbar-width")}}
+ +

scrollbar-color

+ +
{{Compat("css.properties.scrollbar-color")}}
-- cgit v1.2.3-54-g00ecf