scrollbar-color
Quick Summary for scrollbar-color
The scrollbar-color CSS property sets the color of the scrollbar track and thumb.
Code Usage for scrollbar-color
/* Keyword values */ scrollbar-color: auto;  /* <color> values */ scrollbar-color: rebeccapurple green;   /* Two valid colors. The first applies to the thumb of the scrollbar, the second to the track. */  /* Global values */ scrollbar-color: inherit; scrollbar-color: initial; scrollbar-color: revert; scrollbar-color: unset; 
More Details for scrollbar-color

scrollbar-color

The scrollbar-color CSS property sets the color of the scrollbar track and thumb.

The track refers to the background of the scrollbar, which is generally fixed regardless of the scrolling position.

The thumb refers to the moving part of the scrollbar, which usually floats on top of the track.

Syntax

/* Keyword values */ scrollbar-color: auto;  /* <color> values */ scrollbar-color: rebeccapurple green;   /* Two valid colors. The first applies to the thumb of the scrollbar, the second to the track. */  /* Global values */ scrollbar-color: inherit; scrollbar-color: initial; scrollbar-color: revert; scrollbar-color: unset; 

Values

<scrollbar-color>

Defines the color of the scrollbar.

auto Default platform rendering for the track portion of the scrollbar, in the absence of any other related scrollbar color properties.
<color> <color> Applies the first color to the scrollbar thumb, the second to the scrollbar track.

Note: User Agents must apply any scrollbar-color value set on the root element to the viewport.

Accessibility concerns

When using scrollbar-color property with specific color values, authors should ensure the specified colors have enough contrast between them. For keyword values, UAs should ensure the colors they use have enough contrast. See Techniques for WCAG 2.0: G183: Using a contrast ratio of 3:1.

Formal definition

Initial valueauto
Applies toscrolling boxes
Inheritedyes
Computed valueas specified
Animation typea color

Formal syntax

auto | <color>{2}

where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hwb()> | <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>? )<hwb()> = hwb( [<hue> | none] [<percentage> | none] [<percentage> | none] [ / [<alpha-value> | none] ]? )

where <alpha-value> = <number> | <percentage><hue> = <number> | <angle>

Examples

Coloring overflow scrollbars

CSS
.scroller {   width: 300px;   height: 100px;   overflow-y: scroll;   scrollbar-color: rebeccapurple green; } 
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

Specifications

Specification
CSS Scrollbars Styling Module Level 1 # scrollbar-color

See also

scrollbar-width overflow

Last modified: Aug 12, 2021, by MDN contributors

Select your preferred language English (US)Français日本語Português (do Brasil)中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote


Bajo
Random CSS Property

border-inline-end-style

The border-inline-end-style CSS property defines the style of the logical inline end border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation.
border-inline-end-style css reference