scrollbar-width
Quick Summary for scrollbar-width
The scrollbar-width property allows the author to set the maximum thickness of an element's scrollbars when they are shown.
Code Usage for scrollbar-width
/* Keyword values */ scrollbar-width: auto; scrollbar-width: thin; scrollbar-width: none;  /* Global values */ scrollbar-width: inherit; scrollbar-width: initial; scrollbar-width: revert; scrollbar-width: unset; 
More Details for scrollbar-width

scrollbar-width

The scrollbar-width property allows the author to set the maximum thickness of an element's scrollbars when they are shown.

Syntax

/* Keyword values */ scrollbar-width: auto; scrollbar-width: thin; scrollbar-width: none;  /* Global values */ scrollbar-width: inherit; scrollbar-width: initial; scrollbar-width: revert; scrollbar-width: unset; 

Values

<scrollbar-width>

Defines the width of the scrollbar as a keyword. It must be one of the following values:

auto The default scrollbar width for the platform.
thin A thin scrollbar width variant on platforms that provide that option, or a thinner scrollbar than the default platform scrollbar width.
none No scrollbar shown, however the element will still be scrollable.

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

Accessibility concerns

Use this property with caution — setting scrollbar-width to thin or none can make content hard or impossible to scroll if the author does not provide an alternative scrolling mechanism. While swiping gestures or mouse wheels can enable scrolling on such content, some devices have no scroll alternative.

WCAG criterion 2.1.1 (Keyboard) has been in place for a long time to advise on basic keyboard accessibility, and this should include scrolling of content areas. And introduced in WCAG 2.1, criterion 2.5.5 (Target Size) advises that touch targets should be at least 44px in width and height (although the problem is compounded on high-resolution screens; thorough testing is advised).

MDN Understanding WCAG, Guideline 2.1 explanations MDN Understanding WCAG, Guideline 2.5 explanations Understanding Success Criterion 2.1.1 | W3C Understanding WCAG 2.1 Understanding Success Criterion 2.5.5 | W3C Understanding WCAG 2.1

Formal definition

Initial valueauto
Applies toscrolling boxes
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

auto | thin | none

Examples

Sizing overflow scrollbars

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

Specifications

Specification
CSS Scrollbars Styling Module Level 1 # scrollbar-width

See also

-ms-overflow-style ::-webkit-scrollbar Select your preferred language English (US)Français日本語中文 (简体) 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
A person who never made a mistake never tried anything new.
Albert Einstein
Random CSS Property

opacity()

The opacity() CSS function applies transparency to the samples in the input image. Its result is a <filter-function>.
opacity() css reference