非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
弃用
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the
兼容性表格
at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
-ms-scrollbar-track-color
CSS
特性为
Microsoft extension
that specifies the color of the track element of a scrollbar.
| 初始值 |
Scrollbar
|
|---|---|
| 适用于 | 所有元素 |
| 继承 | yes |
| 计算值 | 如指定 |
| 动画类型 | discrete |
<color>
The color of the track element.
<color>where
<color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where
<rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )
<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )
<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )
<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where
<alpha-value> = <number> | <percentage>
<hue> = <number> | <angle>
此范例使用
-ms-scrollbar-track-color
,
-ms-scrollbar-face-color
,和
-ms-scrollbar-arrow-color
to create two
<div>
elements with different scroll bar color schemes.
div {
width: 150px;
height: 150px;
border-style: solid;
border-width: thin;
overflow-y: scroll;
font-family: sans-serif;
float: left;
margin-right: 10px;
}
.blueScroll {
-ms-scrollbar-highlight-color: aqua;
-ms-scrollbar-face-color: blue;
-ms-scrollbar-arrow-color: blue;
border-color: blue;
}
.redScroll {
-ms-scrollbar-highlight-color: bisque;
-ms-scrollbar-face-color: red;
-ms-scrollbar-arrow-color: red;
border-color: red;
}
<body>
<div class="blueScroll">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div class="redScroll">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</body>
The following image shows the result.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
-ms-scrollbar-track-color
弃用
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 不支持 No |
IE
完整支持
5
Alternate Name
|
Opera 不支持 No | Safari 不支持 No | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
完整支持
不支持
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
使用非标名称。
In Windows Internet Explorer 8 the
-ms-scrollbar-track-color
attribute is an extension to CSS, and can be used as a synonym for
scrollbar-track-color
in IE8 Standards Mode.
The track is the element of a scroll bar on which the scroll box can slide either up and down or left and right. The scroll box is the rectangular box within a scroll bar that can be moved either up and down or left and right on a track to change the position of the content on the screen.
This property applies to elements that display a scroll bar. CSS enables scrolling on all objects through the
overflow
特性。