CINXE.COM
CSS Scrollbars Styling Module Level 1
<!doctype html><html lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"> <title>CSS Scrollbars Styling Module Level 1</title> <meta content="ED" name="w3c-status"> <meta content="Bikeshed version 60c422380, updated Thu Feb 20 19:11:22 2025 -0800" name="generator"> <link href="https://www.w3.org/TR/css-scrollbars-1/" rel="canonical"> <meta content="00a4565adc80e6981e7fdefb92480d41c0f5ffea" name="revision"> <meta content="dark light" name="color-scheme"> <style>/* Boilerplate: style-autolinks */ .css.css, .property.property, .descriptor.descriptor { color: var(--a-normal-text); font-size: inherit; font-family: inherit; } .css::before, .property::before, .descriptor::before { content: "‘"; } .css::after, .property::after, .descriptor::after { content: "’"; } .property, .descriptor { /* Don't wrap property and descriptor names */ white-space: nowrap; } .type { /* CSS value <type> */ font-style: italic; } pre .property::before, pre .property::after { content: ""; } [data-link-type="property"]::before, [data-link-type="propdesc"]::before, [data-link-type="descriptor"]::before, [data-link-type="value"]::before, [data-link-type="function"]::before, [data-link-type="at-rule"]::before, [data-link-type="selector"]::before, [data-link-type="maybe"]::before { content: "‘"; } [data-link-type="property"]::after, [data-link-type="propdesc"]::after, [data-link-type="descriptor"]::after, [data-link-type="value"]::after, [data-link-type="function"]::after, [data-link-type="at-rule"]::after, [data-link-type="selector"]::after, [data-link-type="maybe"]::after { content: "’"; } [data-link-type].production::before, [data-link-type].production::after, .prod [data-link-type]::before, .prod [data-link-type]::after { content: ""; } [data-link-type=element], [data-link-type=element-attr] { font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: .9em; } [data-link-type=element]::before { content: "<" } [data-link-type=element]::after { content: ">" } [data-link-type=biblio] { white-space: pre; } @media (prefers-color-scheme: dark) { :root { --selflink-text: black; --selflink-bg: silver; --selflink-hover-text: white; } } </style> <style>/* Boilerplate: style-colors */ /* Any --*-text not paired with a --*-bg is assumed to have a transparent bg */ :root { color-scheme: light dark; --text: black; --bg: white; --unofficial-watermark: url(https://www.w3.org/StyleSheets/TR/2016/logos/UD-watermark); --logo-bg: #1a5e9a; --logo-active-bg: #c00; --logo-text: white; --tocnav-normal-text: #707070; --tocnav-normal-bg: var(--bg); --tocnav-hover-text: var(--tocnav-normal-text); --tocnav-hover-bg: #f8f8f8; --tocnav-active-text: #c00; --tocnav-active-bg: var(--tocnav-normal-bg); --tocsidebar-text: var(--text); --tocsidebar-bg: #f7f8f9; --tocsidebar-shadow: rgba(0,0,0,.1); --tocsidebar-heading-text: hsla(203,20%,40%,.7); --toclink-text: var(--text); --toclink-underline: #3980b5; --toclink-visited-text: var(--toclink-text); --toclink-visited-underline: #054572; --heading-text: #005a9c; --hr-text: var(--text); --algo-border: #def; --del-text: red; --del-bg: transparent; --ins-text: #080; --ins-bg: transparent; --a-normal-text: #034575; --a-normal-underline: #bbb; --a-visited-text: var(--a-normal-text); --a-visited-underline: #707070; --a-hover-bg: rgba(75%, 75%, 75%, .25); --a-active-text: #c00; --a-active-underline: #c00; --blockquote-border: silver; --blockquote-bg: transparent; --blockquote-text: currentcolor; --issue-border: #e05252; --issue-bg: #fbe9e9; --issue-text: var(--text); --issueheading-text: #831616; --example-border: #e0cb52; --example-bg: #fcfaee; --example-text: var(--text); --exampleheading-text: #574b0f; --note-border: #52e052; --note-bg: #e9fbe9; --note-text: var(--text); --noteheading-text: hsl(120, 70%, 30%); --notesummary-underline: silver; --assertion-border: #aaa; --assertion-bg: #eee; --assertion-text: black; --advisement-border: orange; --advisement-bg: #fec; --advisement-text: var(--text); --advisementheading-text: #b35f00; --warning-border: red; --warning-bg: hsla(40,100%,50%,0.95); --warning-text: var(--text); --amendment-border: #330099; --amendment-bg: #F5F0FF; --amendment-text: var(--text); --amendmentheading-text: #220066; --def-border: #8ccbf2; --def-bg: #def; --def-text: var(--text); --defrow-border: #bbd7e9; --datacell-border: silver; --indexinfo-text: #707070; --indextable-hover-text: black; --indextable-hover-bg: #f7f8f9; --outdatedspec-bg: rgba(0, 0, 0, .5); --outdatedspec-text: black; --outdated-bg: maroon; --outdated-text: white; --outdated-shadow: red; --editedrec-bg: darkorange; } @media (prefers-color-scheme: dark) { :root { --text: #ddd; --bg: black; --unofficial-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='%23100808' transform='translate(200 200) rotate(-45) translate(-200 -200)' stroke='%23100808' stroke-width='3'%3E%3Ctext x='50%25' y='220' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EUNOFFICIAL%3C/text%3E%3Ctext x='50%25' y='305' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EDRAFT%3C/text%3E%3C/g%3E%3C/svg%3E"); --logo-bg: #1a5e9a; --logo-active-bg: #c00; --logo-text: white; --tocnav-normal-text: #999; --tocnav-normal-bg: var(--bg); --tocnav-hover-text: var(--tocnav-normal-text); --tocnav-hover-bg: #080808; --tocnav-active-text: #f44; --tocnav-active-bg: var(--tocnav-normal-bg); --tocsidebar-text: var(--text); --tocsidebar-bg: #080808; --tocsidebar-shadow: rgba(255,255,255,.1); --tocsidebar-heading-text: hsla(203,20%,40%,.7); --toclink-text: var(--text); --toclink-underline: #6af; --toclink-visited-text: var(--toclink-text); --toclink-visited-underline: #054572; --heading-text: #8af; --hr-text: var(--text); --algo-border: #456; --del-text: #f44; --del-bg: transparent; --ins-text: #4a4; --ins-bg: transparent; --a-normal-text: #6af; --a-normal-underline: #555; --a-visited-text: var(--a-normal-text); --a-visited-underline: var(--a-normal-underline); --a-hover-bg: rgba(25%, 25%, 25%, .2); --a-active-text: #f44; --a-active-underline: var(--a-active-text); --borderedblock-bg: rgba(255, 255, 255, .05); --blockquote-border: silver; --blockquote-bg: var(--borderedblock-bg); --blockquote-text: currentcolor; --issue-border: #e05252; --issue-bg: var(--borderedblock-bg); --issue-text: var(--text); --issueheading-text: hsl(0deg, 70%, 70%); --example-border: hsl(50deg, 90%, 60%); --example-bg: var(--borderedblock-bg); --example-text: var(--text); --exampleheading-text: hsl(50deg, 70%, 70%); --note-border: hsl(120deg, 100%, 35%); --note-bg: var(--borderedblock-bg); --note-text: var(--text); --noteheading-text: hsl(120, 70%, 70%); --notesummary-underline: silver; --assertion-border: #444; --assertion-bg: var(--borderedblock-bg); --assertion-text: var(--text); --advisement-border: orange; --advisement-bg: #222218; --advisement-text: var(--text); --advisementheading-text: #f84; --warning-border: red; --warning-bg: hsla(40,100%,20%,0.95); --warning-text: var(--text); --amendment-border: #330099; --amendment-bg: #080010; --amendment-text: var(--text); --amendmentheading-text: #cc00ff; --def-border: #8ccbf2; --def-bg: #080818; --def-text: var(--text); --defrow-border: #136; --datacell-border: silver; --indexinfo-text: #aaa; --indextable-hover-text: var(--text); --indextable-hover-bg: #181818; --outdatedspec-bg: rgba(255, 255, 255, .5); --outdatedspec-text: black; --outdated-bg: maroon; --outdated-text: white; --outdated-shadow: red; --editedrec-bg: darkorange; } /* In case a transparent-bg image doesn't expect to be on a dark bg, which is quite common in practice... */ img { background: white; } } </style> <style>/* Boilerplate: style-counters */ body { counter-reset: example figure issue; } .issue { counter-increment: issue; } .issue:not(.no-marker)::before { content: "Issue " counter(issue); } .example { counter-increment: example; } .example:not(.no-marker)::before { content: "Example " counter(example); } .invalid.example:not(.no-marker)::before, .illegal.example:not(.no-marker)::before { content: "Invalid Example" counter(example); } figcaption { counter-increment: figure; } figcaption:not(.no-marker)::before { content: "Figure " counter(figure) " "; } </style> <style>/* Boilerplate: style-dfn-panel */ :root { --dfnpanel-bg: #ddd; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #ffc; --dfnpanel-target-outline: orange; } @media (prefers-color-scheme: dark) { :root { --dfnpanel-bg: #222; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #333; --dfnpanel-target-outline: silver; } } .dfn-panel { position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.75em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--dfnpanel-bg); color: var(--dfnpanel-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .dfn-panel:not(.on) { display: none; } .dfn-panel * { margin: 0; padding: 0; text-indent: 0; } .dfn-panel > b { display: block; } .dfn-panel a { color: var(--dfnpanel-text); } .dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; } .dfn-panel a:focus { outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color; } .dfn-panel > b + b { margin-top: 0.25em; } .dfn-panel ul { padding: 0 0 0 1em; list-style: none; } .dfn-panel li a { max-width: calc(300px - 1.5em - 1em); overflow: hidden; text-overflow: ellipsis; } .dfn-panel.activated { display: inline-block; position: fixed; left: 8px; bottom: 2em; margin: 0 auto; max-width: calc(100vw - 1.5em - .4em - .5em); max-height: 30vh; transition: left 1s ease-out, bottom 1s ease-out; } .dfn-panel .link-item:hover { text-decoration: underline; } .dfn-panel .link-item .copy-icon { opacity: 0; } .dfn-panel .link-item:hover .copy-icon, .dfn-panel .link-item .copy-icon:focus { opacity: 1; } .dfn-panel .copy-icon { display: inline-block; margin-right: 0.5em; width: 0.85em; height: 1em; border-radius: 3px; background-color: #ccc; cursor: pointer; } .dfn-panel .copy-icon .icon { width: 100%; height: 100%; background-color: #fff; display: flex; justify-content: center; align-items: center; position: relative; } .dfn-panel .copy-icon .icon::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 1px solid black; background-color: #ccc; opacity: 0.25; transform: translate(3px, -3px); } .dfn-panel .copy-icon:active .icon::before { opacity: 1; } .dfn-paneled[role="button"] { cursor: help; } .highlighted { animation: target-fade 3s; } @keyframes target-fade { from { background-color: var(--dfnpanel-target-bg); outline: 5px solid var(--dfnpanel-target-outline); } to { color: var(--a-normal-text); background-color: transparent; outline: transparent; } } </style> <style>/* Boilerplate: style-issues */ a[href].issue-return { float: right; float: inline-end; color: var(--issueheading-text); font-weight: bold; text-decoration: none; } </style> <style>/* Boilerplate: style-md-lists */ /* This is a weird hack for me not yet following the commonmark spec regarding paragraph and lists. */ [data-md] > :first-child { margin-top: 0; } [data-md] > :last-child { margin-bottom: 0; } </style> <style>/* Boilerplate: style-mdn-anno */ :root { --mdn-bg: #EEE; --mdn-shadow: #999; --mdn-nosupport-text: #ccc; --mdn-pass: green; --mdn-fail: red; } @media (prefers-color-scheme: dark) { :root { --mdn-bg: #222; --mdn-shadow: #444; --mdn-nosupport-text: #666; --mdn-pass: #690; --mdn-fail: #d22; } } .mdn-anno { background: var(--mdn-bg, #EEE); border-radius: .25em; box-shadow: 0 0 3px var(--mdn-shadow, #999); color: var(--text, black); font: 1em sans-serif; hyphens: none; max-width: min-content; overflow: hidden; padding: 0.2em; position: absolute; right: 0.3em; top: auto; white-space: nowrap; word-wrap: normal; z-index: 8; } .mdn-anno.unpositioned { display: none; } .mdn-anno.overlapping-main { opacity: .2; transition: opacity .1s; } .mdn-anno[open] { opacity: 1; z-index: 9; min-width: 9em; } .mdn-anno:hover { opacity: 1; outline: var(--text, black) 1px solid; } .mdn-anno > summary { font-weight: normal; text-align: right; cursor: pointer; display: block; } .mdn-anno > summary > .less-than-two-engines-flag { color: var(--mdn-fail); padding-right: 2px; } .mdn-anno > summary > .all-engines-flag { color: var(--mdn-pass); padding-right: 2px; } .mdn-anno > summary > span { color: #fff; background-color: #000; font-weight: normal; font-family: zillaslab, Palatino, "Palatino Linotype", serif; padding: 2px 3px 0px 3px; line-height: 1.3em; vertical-align: top; } .mdn-anno > .feature { margin-top: 20px; } .mdn-anno > .feature:not(:first-of-type) { border-top: 1px solid #999; margin-top: 6px; padding-top: 2px; } .mdn-anno > .feature > .less-than-two-engines-text { color: var(--mdn-fail); } .mdn-anno > .feature > .all-engines-text { color: var(--mdn-pass); } .mdn-anno > .feature > p { font-size: .75em; margin-top: 6px; margin-bottom: 0; } .mdn-anno > .feature > p + p { margin-top: 3px; } .mdn-anno > .feature > .support { display: block; font-size: 0.6em; margin: 0; padding: 0; margin-top: 2px; } .mdn-anno > .feature > .support + div { padding-top: 0.5em; } .mdn-anno > .feature > .support > hr { display: block; border: none; border-top: 1px dotted #999; padding: 3px 0px 0px 0px; margin: 2px 3px 0px 3px; } .mdn-anno > .feature > .support > hr::before { content: ""; } .mdn-anno > .feature > .support > span { padding: 0.2em 0; display: block; display: table; } .mdn-anno > .feature > .support > span.no { color: var(--mdn-nosupport-text); filter: grayscale(100%); } .mdn-anno > .feature > .support > span.no::before { opacity: 0.5; } .mdn-anno > .feature > .support > span:first-of-type { padding-top: 0.5em; } .mdn-anno > .feature > .support > span > span { padding: 0 0.5em; display: table-cell; } .mdn-anno > .feature > .support > span > span:first-child { width: 100%; } .mdn-anno > .feature > .support > span > span:last-child { width: 100%; white-space: pre; padding: 0; } .mdn-anno > .feature > .support > span::before { content: ' '; display: table-cell; min-width: 1.5em; height: 1.5em; background: no-repeat center center; background-size: contain; text-align: right; font-size: 0.75em; font-weight: bold; } .mdn-anno > .feature > .support > .chrome_android::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .mdn-anno > .feature > .support > .firefox_android::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .mdn-anno > .feature > .support > .chrome::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .mdn-anno > .feature > .support > .edge_blink::before { background-image: url(https://resources.whatwg.org/browser-logos/edge.svg); } .mdn-anno > .feature > .support > .edge::before { background-image: url(https://resources.whatwg.org/browser-logos/edge_legacy.svg); } .mdn-anno > .feature > .support > .firefox::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .mdn-anno > .feature > .support > .ie::before { background-image: url(https://resources.whatwg.org/browser-logos/ie.png); } .mdn-anno > .feature > .support > .safari_ios::before { background-image: url(https://resources.whatwg.org/browser-logos/safari-ios.svg); } .mdn-anno > .feature > .support > .nodejs::before { background-image: url(https://nodejs.org/favicon.ico); } .mdn-anno > .feature > .support > .opera_android::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); } .mdn-anno > .feature > .support > .opera::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); } .mdn-anno > .feature > .support > .safari::before { background-image: url(https://resources.whatwg.org/browser-logos/safari.png); } .mdn-anno > .feature > .support > .samsunginternet_android::before { background-image: url(https://resources.whatwg.org/browser-logos/samsung.svg); } .mdn-anno > .feature > .support > .webview_android::before { background-image: url(https://resources.whatwg.org/browser-logos/android-webview.png); } .name-slug-mismatch { color: red; } .caniuse-status:hover { z-index: 9; } /* dt, li, .issue, .note, and .example are "position: relative", so to put annotation at right margin, must move to right of containing block */; .h-entry:not(.status-LS) dt > .mdn-anno, .h-entry:not(.status-LS) li > .mdn-anno, .h-entry:not(.status-LS) .issue > .mdn-anno, .h-entry:not(.status-LS) .note > .mdn-anno, .h-entry:not(.status-LS) .example > .mdn-anno { right: -6.7em; } .h-entry p + .mdn-anno { margin-top: 0; } h2 + .mdn-anno.after { margin: -48px 0 0 0; } h3 + .mdn-anno.after { margin: -46px 0 0 0; } h4 + .mdn-anno.after { margin: -42px 0 0 0; } h5 + .mdn-anno.after { margin: -40px 0 0 0; } h6 + .mdn-anno.after { margin: -40px 0 0 0; } </style> <style>/* Boilerplate: style-ref-hints */ :root { --ref-hint-bg: #ddd; --ref-hint-text: var(--text); } @media (prefers-color-scheme: dark) { :root { --ref-hint-bg: #222; --ref-hint-text: var(--text); } } .ref-hint { display: inline-block; position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.5em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--ref-hint-bg); color: var(--ref-hint-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .ref-hint * { margin: 0; padding: 0; text-indent: 0; } .ref-hint ul { padding: 0 0 0 1em; list-style: none; } </style> <style>/* Boilerplate: style-selflinks */ :root { --selflink-text: white; --selflink-bg: gray; --selflink-hover-text: black; } .heading, .issue, .note, .example, li, dt { position: relative; } a.self-link { position: absolute; top: 0; left: calc(-1 * (3.5rem - 26px)); width: calc(3.5rem - 26px); height: 2em; text-align: center; border: none; transition: opacity .2s; opacity: .5; } a.self-link:hover { opacity: 1; } .heading > a.self-link { font-size: 83%; } .example > a.self-link, .note > a.self-link, .issue > a.self-link { /* These blocks are overflow:auto, so positioning outside doesn't work. */ left: auto; right: 0; } li > a.self-link { left: calc(-1 * (3.5rem - 26px) - 2em); } dfn > a.self-link { top: auto; left: auto; opacity: 0; width: 1.5em; height: 1.5em; background: var(--selflink-bg); color: var(--selflink-text); font-style: normal; transition: opacity .2s, background-color .2s, color .2s; } dfn:hover > a.self-link { opacity: 1; } dfn > a.self-link:hover { color: var(--selflink-hover-text); } a.self-link::before { content: "¶"; } .heading > a.self-link::before { content: "§"; } dfn > a.self-link::before { content: "#"; } </style> <style>/* Boilerplate: style-syntax-highlighting */ code.highlight { padding: .1em; border-radius: .3em; } pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; } .highlight:not(.idl) { background: rgba(0, 0, 0, .03); } c-[a] { color: #990055 } /* Keyword.Declaration */ c-[b] { color: #990055 } /* Keyword.Type */ c-[c] { color: #708090 } /* Comment */ c-[d] { color: #708090 } /* Comment.Multiline */ c-[e] { color: #0077aa } /* Name.Attribute */ c-[f] { color: #669900 } /* Name.Tag */ c-[g] { color: #222222 } /* Name.Variable */ c-[k] { color: #990055 } /* Keyword */ c-[l] { color: #000000 } /* Literal */ c-[m] { color: #000000 } /* Literal.Number */ c-[n] { color: #0077aa } /* Name */ c-[o] { color: #999999 } /* Operator */ c-[p] { color: #999999 } /* Punctuation */ c-[s] { color: #a67f59 } /* Literal.String */ c-[t] { color: #a67f59 } /* Literal.String.Single */ c-[u] { color: #a67f59 } /* Literal.String.Double */ c-[cp] { color: #708090 } /* Comment.Preproc */ c-[c1] { color: #708090 } /* Comment.Single */ c-[cs] { color: #708090 } /* Comment.Special */ c-[kc] { color: #990055 } /* Keyword.Constant */ c-[kn] { color: #990055 } /* Keyword.Namespace */ c-[kp] { color: #990055 } /* Keyword.Pseudo */ c-[kr] { color: #990055 } /* Keyword.Reserved */ c-[ld] { color: #000000 } /* Literal.Date */ c-[nc] { color: #0077aa } /* Name.Class */ c-[no] { color: #0077aa } /* Name.Constant */ c-[nd] { color: #0077aa } /* Name.Decorator */ c-[ni] { color: #0077aa } /* Name.Entity */ c-[ne] { color: #0077aa } /* Name.Exception */ c-[nf] { color: #0077aa } /* Name.Function */ c-[nl] { color: #0077aa } /* Name.Label */ c-[nn] { color: #0077aa } /* Name.Namespace */ c-[py] { color: #0077aa } /* Name.Property */ c-[ow] { color: #999999 } /* Operator.Word */ c-[mb] { color: #000000 } /* Literal.Number.Bin */ c-[mf] { color: #000000 } /* Literal.Number.Float */ c-[mh] { color: #000000 } /* Literal.Number.Hex */ c-[mi] { color: #000000 } /* Literal.Number.Integer */ c-[mo] { color: #000000 } /* Literal.Number.Oct */ c-[sb] { color: #a67f59 } /* Literal.String.Backtick */ c-[sc] { color: #a67f59 } /* Literal.String.Char */ c-[sd] { color: #a67f59 } /* Literal.String.Doc */ c-[se] { color: #a67f59 } /* Literal.String.Escape */ c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */ c-[si] { color: #a67f59 } /* Literal.String.Interpol */ c-[sx] { color: #a67f59 } /* Literal.String.Other */ c-[sr] { color: #a67f59 } /* Literal.String.Regex */ c-[ss] { color: #a67f59 } /* Literal.String.Symbol */ c-[vc] { color: #0077aa } /* Name.Variable.Class */ c-[vg] { color: #0077aa } /* Name.Variable.Global */ c-[vi] { color: #0077aa } /* Name.Variable.Instance */ c-[il] { color: #000000 } /* Literal.Number.Integer.Long */ @media (prefers-color-scheme: dark) { .highlight:not(.idl) { background: rgba(255, 255, 255, .05); } c-[a] { color: #d33682 } /* Keyword.Declaration */ c-[b] { color: #d33682 } /* Keyword.Type */ c-[c] { color: #2aa198 } /* Comment */ c-[d] { color: #2aa198 } /* Comment.Multiline */ c-[e] { color: #268bd2 } /* Name.Attribute */ c-[f] { color: #b58900 } /* Name.Tag */ c-[g] { color: #cb4b16 } /* Name.Variable */ c-[k] { color: #d33682 } /* Keyword */ c-[l] { color: #657b83 } /* Literal */ c-[m] { color: #657b83 } /* Literal.Number */ c-[n] { color: #268bd2 } /* Name */ c-[o] { color: #657b83 } /* Operator */ c-[p] { color: #657b83 } /* Punctuation */ c-[s] { color: #6c71c4 } /* Literal.String */ c-[t] { color: #6c71c4 } /* Literal.String.Single */ c-[u] { color: #6c71c4 } /* Literal.String.Double */ c-[ch] { color: #2aa198 } /* Comment.Hashbang */ c-[cp] { color: #2aa198 } /* Comment.Preproc */ c-[cpf] { color: #2aa198 } /* Comment.PreprocFile */ c-[c1] { color: #2aa198 } /* Comment.Single */ c-[cs] { color: #2aa198 } /* Comment.Special */ c-[kc] { color: #d33682 } /* Keyword.Constant */ c-[kn] { color: #d33682 } /* Keyword.Namespace */ c-[kp] { color: #d33682 } /* Keyword.Pseudo */ c-[kr] { color: #d33682 } /* Keyword.Reserved */ c-[ld] { color: #657b83 } /* Literal.Date */ c-[nc] { color: #268bd2 } /* Name.Class */ c-[no] { color: #268bd2 } /* Name.Constant */ c-[nd] { color: #268bd2 } /* Name.Decorator */ c-[ni] { color: #268bd2 } /* Name.Entity */ c-[ne] { color: #268bd2 } /* Name.Exception */ c-[nf] { color: #268bd2 } /* Name.Function */ c-[nl] { color: #268bd2 } /* Name.Label */ c-[nn] { color: #268bd2 } /* Name.Namespace */ c-[py] { color: #268bd2 } /* Name.Property */ c-[ow] { color: #657b83 } /* Operator.Word */ c-[mb] { color: #657b83 } /* Literal.Number.Bin */ c-[mf] { color: #657b83 } /* Literal.Number.Float */ c-[mh] { color: #657b83 } /* Literal.Number.Hex */ c-[mi] { color: #657b83 } /* Literal.Number.Integer */ c-[mo] { color: #657b83 } /* Literal.Number.Oct */ c-[sa] { color: #6c71c4 } /* Literal.String.Affix */ c-[sb] { color: #6c71c4 } /* Literal.String.Backtick */ c-[sc] { color: #6c71c4 } /* Literal.String.Char */ c-[dl] { color: #6c71c4 } /* Literal.String.Delimiter */ c-[sd] { color: #6c71c4 } /* Literal.String.Doc */ c-[se] { color: #6c71c4 } /* Literal.String.Escape */ c-[sh] { color: #6c71c4 } /* Literal.String.Heredoc */ c-[si] { color: #6c71c4 } /* Literal.String.Interpol */ c-[sx] { color: #6c71c4 } /* Literal.String.Other */ c-[sr] { color: #6c71c4 } /* Literal.String.Regex */ c-[ss] { color: #6c71c4 } /* Literal.String.Symbol */ c-[fm] { color: #268bd2 } /* Name.Function.Magic */ c-[vc] { color: #cb4b16 } /* Name.Variable.Class */ c-[vg] { color: #cb4b16 } /* Name.Variable.Global */ c-[vi] { color: #cb4b16 } /* Name.Variable.Instance */ c-[vm] { color: #cb4b16 } /* Name.Variable.Magic */ c-[il] { color: #657b83 } /* Literal.Number.Integer.Long */ } </style> <style>/* Boilerplate: style-wpt */ :root { --wpt-border: hsl(0, 0%, 60%); --wpt-bg: hsl(0, 0%, 95%); --wpt-text: var(--text); --wptheading-text: hsl(0, 0%, 30%); } @media (prefers-color-scheme: dark) { :root { --wpt-border: hsl(0, 0%, 30%); --wpt-bg: var(--borderedblock-bg); --wpt-text: var(--text); --wptheading-text: hsl(0, 0%, 60%); } } .wpt-tests-block { list-style: none; border-left: .5em solid var(--wpt-border); background: var(--wpt-bg); color: var(--wpt-text); margin: 1em auto; padding: .5em; } .wpt-tests-block summary { color: var(--wptheading-text); font-weight: normal; text-transform: uppercase; } .wpt-tests-block summary::marker{ color: var(--wpt-border); } .wpt-tests-block summary:hover::marker{ color: var(--wpt-text); } /* The only content of a wpt test block in its closed state is the <summary>, which contains the word TESTS, and that is absolutely positioned. In that closed state, wpt test blocks are styled to have a top margin whose height is exactly equal to the height of the absolutely positioned <summary>, and no other background/padding/margin/border. The wpt test block elements will therefore allow the maring of the previous/next block elements to collapse through them; if this combined margin would be larger than its own top margin, it stays as is, and therefore the pre-existing vertical rhythm of the document is undisturbed. If that combined margin would be smaller, it is grown to that size. This means that the wpt test block ensures that there's always enough vertical space to insert the summary, without adding more than is needed. */ .wpt-tests-block:not([open]){ padding: 0; border: none; background: none; font-size: 0.75em; line-height: 1; position: relative; margin: 1em 0 0; } .wpt-tests-block:not([open]) summary { position: absolute; right: 0; bottom: 0; } /* It is possible that both the last child of a block element and the block element itself would be annotated with a <wpt> block each. If the block element has a padding or a border, that's fine, but otherwise the bottom margin of the block and of its last child would collapse and both <wpt> elements would overlap, being both placed there. To avoid that, add 1px of padding to the <wpt> element annotating the last child to prevent the bottom margin of the block and of its last child from collapsing (and as much negative margin, as wel only want to prevent margin collapsing, but are not trying to actually take more space). */ .wpt-tests-block:not([open]):last-child { padding-bottom: 1px; margin-bottom: -1px; } /* Exception to the previous rule: don't do that in non-last list items, because it's not necessary, and would therefore consume more space than strictly needed. Lists must have list items as children, not <wpt> elements, so a <wpt> element cannot be a sibling of a list item, and the collision that the previous rule avoids cannot happen. */ li:not(:last-child) > .wpt-tests-block:not([open]):last-child, dd:not(:last-child) > .wpt-tests-block:not([open]):last-child { padding-bottom: 0; margin-bottom: 0; } .wpt-tests-block:not([open]):not(:hover){ opacity: 0.5; } .wpt-tests-list { list-style: none; display: grid; margin: 0; padding: 0; grid-template-columns: 1fr max-content auto auto; grid-column-gap: .5em; } .wpt-tests-block hr:last-child { display: none; } .wpt-test { display: contents; } .wpt-test > a { text-decoration: underline; border: none; } .wpt-test > .wpt-name { grid-column: 1; } .wpt-test > .wpt-results { grid-column: 2; } .wpt-test > .wpt-live { grid-column: 3; } .wpt-test > .wpt-source { grid-column: 4; } .wpt-test > .wpt-results { display: flex; gap: .1em; } .wpt-test .wpt-result { display: inline-block; height: 1em; width: 1em; border-radius: 50%; position: relative; } </style> <link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet"> <link href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css"> <body class="h-entry"> <div class="head"> <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p> <h1 class="p-name no-ref" id="title">CSS Scrollbars Styling Module Level 1</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types/#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2024-09-13">13 September 2024</time></p> <details open> <summary>More details about this document</summary> <div data-fill-with="spec-metadata"> <dl> <dt>This version: <dd><a class="u-url" href="https://drafts.csswg.org/css-scrollbars/">https://drafts.csswg.org/css-scrollbars/</a> <dt>Latest published version: <dd><a href="https://www.w3.org/TR/css-scrollbars-1/">https://www.w3.org/TR/css-scrollbars-1/</a> <dt>Previous Versions: <dd><a href="https://www.w3.org/TR/2021/WD-css-scrollbars-1-20211202/" rel="prev">https://www.w3.org/TR/2021/WD-css-scrollbars-1-20211202/</a> <dd><a href="https://www.w3.org/TR/2021/WD-css-scrollbars-1-20210908/" rel="prev">https://www.w3.org/TR/2021/WD-css-scrollbars-1-20210908/</a> <dd><a href="https://www.w3.org/TR/2021/WD-css-scrollbars-1-20210829/" rel="prev">https://www.w3.org/TR/2021/WD-css-scrollbars-1-20210829/</a> <dd><a href="https://www.w3.org/TR/2021/WD-css-scrollbars-1-20210805/" rel="prev">https://www.w3.org/TR/2021/WD-css-scrollbars-1-20210805/</a> <dd><a href="https://www.w3.org/TR/2018/WD-css-scrollbars-1-20180925/" rel="prev">https://www.w3.org/TR/2018/WD-css-scrollbars-1-20180925/</a> <dt>Implementation Report: <dd><a href="https://wpt.fyi/results/css/css-scrollbars?label=experimental&label=master&aligned">https://wpt.fyi/results/css/css-scrollbars?label=experimental&label=master&aligned</a> <dt>Feedback: <dd><a href="https://github.com/w3c/csswg-drafts/labels/css-scrollbars-1">CSSWG Issues Repository</a> <dt class="editor">Editors: <dd class="editor p-author h-card vcard" data-editor-id="1464"><a class="p-name fn u-url url" href="http://tantek.com/contact">Tantek Çelik</a> (<a class="p-org org" href="https://www.mozilla.org/">Mozilla</a>) <dd class="editor p-author h-card vcard" data-editor-id="49885"><a class="p-name fn u-email email" href="mailto:ratan@microsoft.com">Rossen Atanassov</a> (<span class="p-org org">Microsoft</span>) <dd class="editor p-author h-card vcard" data-editor-id="43241"><a class="p-name fn u-url url" href="https://florian.rivoal.net/">Florian Rivoal</a> (<span class="p-org org">Invited Expert</span>) <dt>Suggest an Edit for this Spec: <dd><a href="https://github.com/w3c/csswg-drafts/blob/main/css-scrollbars-1/Overview.bs">GitHub Editor</a> <dt>Test Suite: <dd class="wpt-overview"><a href="https://wpt.fyi/results/css/css-scrollbars/">https://wpt.fyi/results/css/css-scrollbars/</a> </dl> </div> </details> <div data-fill-with="warning"></div> <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/policies/#copyright">Copyright</a> © 2024 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/copyright/software-license/" rel="license" title="W3C Software and Document License">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <div class="p-summary" data-fill-with="abstract"> <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2> <p>This CSS module defines properties to influence the visual styling of scrollbars, introducing controls for their color and width.</p> <a href="https://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc. <script> const githubPrefix = "https://w3c.github.io/csswg-drafts/"; if(location.href.slice(0, githubPrefix.length) == githubPrefix) { const suffix = location.href.slice(githubPrefix.length); const draftUrl = "https://drafts.csswg.org/" + suffix; window.location.replace(draftUrl); } </script> </div> <h2 class="no-num no-toc no-ref heading settled" id="sotd"><span class="content">Status of this document</span></h2> <div data-fill-with="status"> <p> This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress. </p> <p>Please send feedback by <a href="https://github.com/w3c/csswg-drafts/issues">filing issues in GitHub</a> (preferred), including the spec code “css-scrollbars” in the title, like this: “[css-scrollbars] <i>…summary of comment…</i>”. All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>. Alternately, feedback can be sent to the (<a href="https://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing list <a href="mailto:www-style@w3.org?Subject=%5Bcss-scrollbars%5D%20PUT%20SUBJECT%20HERE">www-style@w3.org</a>. </p> <p>This document is governed by the <a href="https://www.w3.org/policies/process/20231103/" id="w3c_process_revision">03 November 2023 W3C Process Document</a>. </p> </div> <div data-fill-with="at-risk"></div> <nav data-fill-with="table-of-contents" id="toc"> <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2> <ol class="toc" role="directory"> <li> <a href="#intro"><span class="secno">1</span> <span class="content"> Introduction</span></a> <ol class="toc"> <li> <a href="#scope"><span class="secno">1.1</span> <span class="content"> Scope</span></a> <ol class="toc"> <li><a href="#out-of-scope"><span class="secno">1.1.1</span> <span class="content"> Out Of Scope</span></a> </ol> <li><a href="#values"><span class="secno">1.2</span> <span class="content"> Value Definitions</span></a> </ol> <li> <a href="#scrollbar-color"><span class="secno">2</span> <span class="content">Scrollbar Colors: the <span class="property">scrollbar-color</span> property</span></a> <ol class="toc"> <li><a href="#color-compat"><span class="secno">2.1</span> <span class="content"> Interaction with non-standard features</span></a> </ol> <li> <a href="#scrollbar-width"><span class="secno">3</span> <span class="content">Scrollbar Thickness: the <span class="property">scrollbar-width</span> property</span></a> <ol class="toc"> <li><a href="#width-compat"><span class="secno">3.1</span> <span class="content"> Interaction with non-standard features</span></a> </ol> <li><a href="#acknowledgments"><span class="secno"></span> <span class="content"> Appendix A. Acknowledgments</span></a> <li> <a href="#changes"><span class="secno"></span> <span class="content"> Appendix B. Changes</span></a> <ol class="toc"> <li><a href="#changes-since-2021-12-09"><span class="secno"></span> <span class="content"> Changes since the <span>9 December 2021 Candidate Recommendation</span></span></a> <li><a href="#changes-since-2021-12-02"><span class="secno"></span> <span class="content"> Changes since the <span>2021-12-02 Working Draft</span></span></a> <li><a href="#changes-since-2021-08-05"><span class="secno"></span> <span class="content"> Changes from the <span>2021-08-05 Working Draft</span></span></a> <li><a href="#changes-since-2018-09-25"><span class="secno"></span> <span class="content"> Changes from the <span>2018-09-25 First Public Working Draft</span></span></a> </ol> <li> <a href="#security-privacy-considerations"><span class="secno"></span> <span class="content"> Appendix C. Security and Privacy</span></a> <ol class="toc"> <li><a href="#security-considerations"><span class="secno"></span> <span class="content"> Considerations for Security</span></a> <li><a href="#privacy-considerations"><span class="secno"></span> <span class="content"> Considerations for Privacy</span></a> <li><a href="#security-privacy-self-review"><span class="secno"></span> <span class="content"> Self-review questionnaire</span></a> </ol> <li><a href="#accessibility-considerations"><span class="secno"></span> <span class="content"> Appendix D. Considerations for accessibility</span></a> <li> <a href="#w3c-conformance"><span class="secno"></span> <span class="content"> Conformance</span></a> <ol class="toc"> <li><a href="#w3c-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a> <li><a href="#w3c-conformance-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a> <li> <a href="#w3c-partial"><span class="secno"></span> <span class="content"> Partial implementations</span></a> <ol class="toc"> <li><a href="#w3c-conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a> </ol> <li><a href="#w3c-testing"><span class="secno"></span> <span class="content"> Non-experimental implementations</span></a> </ol> <li> <a href="#index"><span class="secno"></span> <span class="content">Index</span></a> <ol class="toc"> <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a> <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a> </ol> <li> <a href="#references"><span class="secno"></span> <span class="content">References</span></a> <ol class="toc"> <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a> <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a> </ol> <li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a> </ol> </nav> <main> <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content"> Introduction</span><a class="self-link" href="#intro"></a></h2> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p><em>This section is non-normative.</em></p> <p>This CSS module introduces properties to influence the visual styling of scrollbars, including their color (<a class="property css" data-link-type="property" href="#propdef-scrollbar-color" id="ref-for-propdef-scrollbar-color">scrollbar-color</a>) and thickness (<a class="property css" data-link-type="property" href="#propdef-scrollbar-width" id="ref-for-propdef-scrollbar-width">scrollbar-width</a>).</p> <h3 class="heading settled" data-level="1.1" id="scope"><span class="secno">1.1. </span><span class="content"> Scope</span><a class="self-link" href="#scope"></a></h3> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>The CSS Scrollbars Module is specifically for styling scrollbar controls themselves, e.g. their color & width in Level 1, and not their layout nor whether any content is scrollable. All layout impacts and content scrollability are specified in the <a href="https://drafts.csswg.org/css-overflow/">CSS Overflow Module</a>.</p> <p>Based on <a href="https://www.w3.org/wiki/Css-scrollbars#Use-cases">documented use-cases</a>, there are three main use-cases around scrollbars this module intends to resolve:</p> <ol> <li>Coloring scrollbars to fit better into the UI of a web application. <li>Using a thinner scrollbar when the scrolling area is small. <li>Hiding UA-provided scrollbars, to allow the provision of custom interfaces for scrolling without affecting other aspects of scrollability. </ol> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>Tests that related to the specification as a whole, without exerting any specific part</p> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/invalid-needs-layout-crash.html" title="css/css-scrollbars/invalid-needs-layout-crash.html">invalid-needs-layout-crash.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/invalid-needs-layout-crash.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/invalid-needs-layout-crash.html"><small>(source)</small></a> </ul> <hr> </details> <h4 class="heading settled" data-level="1.1.1" id="out-of-scope"><span class="secno">1.1.1. </span><span class="content"> Out Of Scope</span><a class="self-link" href="#out-of-scope"></a></h4> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>The internal structure, layout, and configuration of scrollbars, as well as precise control over their coloring, is out of scope. This is because different platforms have different scrollbar structures and styling conventions, and operating systems continuously evolve their scrollbar designs to provide better user experience. Pseudo-elements for selecting specific parts of a scrollbar, for example, were considered and rejected. While this level of fine control would be tempting for authors, the arrangement of the various parts—or whether they’re even all present—cannot be depended on. Providing too much control would allow authors to get perfect results on some platforms, but at the expense of broken results on others.</p> <p class="note" role="note"><span class="marker">Note:</span> Exposing the scrollbar-related <code>::-webkit-</code> prefixed pseudo-elements to the Web is considered a mistake by both the CSS Working Group and Webkit. Nevertheless, see <a href="#color-compat">§ 2.1 Interaction with non-standard features</a> and <a href="#width-compat">§ 3.1 Interaction with non-standard features</a>.</p> <h3 class="heading settled" data-level="1.2" id="values"><span class="secno">1.2. </span><span class="content"> Value Definitions</span><a class="self-link" href="#values"></a></h3> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section does not introduce any new normative requirement, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from <a data-link-type="biblio" href="#biblio-css2" title="Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification">[CSS2]</a> using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from <a data-link-type="biblio" href="#biblio-css-values-3" title="CSS Values and Units Module Level 3">[CSS-VALUES-3]</a>. Value types not defined in this specification are defined in CSS Values & Units <span title="CSS Values and Units Module Level 3">[CSS-VALUES-3]</span>. Combination with other CSS modules may expand the definitions of these value types.</p> <p>In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the <a data-link-type="dfn" href="https://drafts.csswg.org/css-values-4/#css-wide-keywords" id="ref-for-css-wide-keywords">CSS-wide keywords</a> as their property value. For readability they have not been repeated explicitly.</p> <h2 class="heading settled" data-level="2" id="scrollbar-color"><span class="secno">2. </span><span class="content">Scrollbar Colors: the <a class="property css" data-link-type="property" href="#propdef-scrollbar-color" id="ref-for-propdef-scrollbar-color①">scrollbar-color</a> property</span><a class="self-link" href="#scrollbar-color"></a></h2> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p> This section has partial test coverage. <p>Missing:</p> <ul> <li data-md> <p>Tests checking that the property does anything</p> <li data-md> <p>Tests checking that the colors apply to the right parts</p> <li data-md> <p>Initial value</p> </ul> </p> <ul class="wpt-tests-list"></ul> <hr> <p> The following tests have no basis in the spec: they assume that making the thumb and the track transparent must make the whole scollbar invisible. This is not necessarily true: <ul> <li data-md> <p>the scrollbar may have other parts, such as scroll up/down/left/right buttons</p> <li data-md> <p>the spec does not require that the thumb / track are painted solid with the specified colors</p> </ul> </p> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-012.html" title="css/css-scrollbars/scrollbar-color-012.html">scrollbar-color-012.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-012.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-012.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/transparent-on-root.html" title="css/css-scrollbars/transparent-on-root.html">transparent-on-root.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/transparent-on-root.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/transparent-on-root.html"><small>(source)</small></a> </ul> <hr> </details> <table class="def propdef" data-link-for-hint="scrollbar-color"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-scrollbar-color">scrollbar-color</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod">auto <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one">|</a> <a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-color-5/#typedef-color" id="ref-for-typedef-color"><color></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#mult-num" id="ref-for-mult-num">{2}</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>auto <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a data-link-type="dfn" href="https://drafts.csswg.org/css-overflow-3/#scroll-container" id="ref-for-scroll-container">scroll containers</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>yes <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>n/a <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>specified keyword or two computed colors <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>by computed value </table> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/inheritance.html" title="css/css-scrollbars/inheritance.html">inheritance.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/inheritance.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/inheritance.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-parsing.html" title="css/css-scrollbars/scrollbar-color-parsing.html">scrollbar-color-parsing.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-parsing.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-parsing.html"><small>(source)</small></a> </ul> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/web-animations/animation-model/animation-types/scrollbar-interpolation.html" title="web-animations/animation-model/animation-types/scrollbar-interpolation.html">scrollbar-interpolation.html</a> <a class="wpt-live" href="http://wpt.live/web-animations/animation-model/animation-types/scrollbar-interpolation.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/web-animations/animation-model/animation-types/scrollbar-interpolation.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/web-animations/animation-model/animation-types/interpolation-per-property-002.html" title="web-animations/animation-model/animation-types/interpolation-per-property-002.html">interpolation-per-property-002.html</a> <a class="wpt-live" href="http://wpt.live/web-animations/animation-model/animation-types/interpolation-per-property-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/web-animations/animation-model/animation-types/interpolation-per-property-002.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/web-animations/animation-model/animation-types/addition-per-property-002.html" title="web-animations/animation-model/animation-types/addition-per-property-002.html">addition-per-property-002.html</a> <a class="wpt-live" href="http://wpt.live/web-animations/animation-model/animation-types/addition-per-property-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/web-animations/animation-model/animation-types/addition-per-property-002.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/web-animations/animation-model/animation-types/accumulation-per-property-002.html" title="web-animations/animation-model/animation-types/accumulation-per-property-002.html">accumulation-per-property-002.html</a> <a class="wpt-live" href="http://wpt.live/web-animations/animation-model/animation-types/accumulation-per-property-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/web-animations/animation-model/animation-types/accumulation-per-property-002.html"><small>(source)</small></a> </ul> </details> <p>This property allows the author to set colors of an element’s scrollbars.</p> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This test useful but insufficient: it checks what the property doesn't do, not what it does.</p> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/input-scrollbar-color.html" title="css/css-scrollbars/input-scrollbar-color.html">input-scrollbar-color.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/input-scrollbar-color.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/input-scrollbar-color.html"><small>(source)</small></a> </ul> <hr> <p>This test useful but insufficient: it checks that *if* the property works, current-color works.</p> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-011.html" title="css/css-scrollbars/scrollbar-color-011.html">scrollbar-color-011.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-011.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-011.html"><small>(source)</small></a> </ul> <hr> <p>These tests are useful but insufficient: *if* the property works at all, they check that it updates correctly.</p> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-dynamic-1.html" title="css/css-scrollbars/scrollbar-color-dynamic-1.html">scrollbar-color-dynamic-1.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-dynamic-1.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-dynamic-1.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-dynamic-2.html" title="css/css-scrollbars/scrollbar-color-dynamic-2.html">scrollbar-color-dynamic-2.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-dynamic-2.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-dynamic-2.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-dynamic-3.html" title="css/css-scrollbars/scrollbar-color-dynamic-3.html">scrollbar-color-dynamic-3.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-dynamic-3.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-dynamic-3.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-dynamic-4.html" title="css/css-scrollbars/scrollbar-color-dynamic-4.html">scrollbar-color-dynamic-4.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-dynamic-4.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-dynamic-4.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-dynamic-5.html" title="css/css-scrollbars/scrollbar-color-dynamic-5.html">scrollbar-color-dynamic-5.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-dynamic-5.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-dynamic-5.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-dynamic-6.html" title="css/css-scrollbars/scrollbar-color-dynamic-6.html">scrollbar-color-dynamic-6.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-dynamic-6.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-dynamic-6.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-dynamic-7.html" title="css/css-scrollbars/scrollbar-color-dynamic-7.html">scrollbar-color-dynamic-7.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-dynamic-7.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-dynamic-7.html"><small>(source)</small></a> </ul> <hr> </details> <p>UAs must apply the scrollbar-color value set on the root element to the viewport.</p> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p> The following test about viewport propagation is useful but insufficient; the test will pass if the property has no effect at all. Also missing: <ul> <li data-md> <p>tests that check the interaction with css-contain, and in particular that that disables propagation</p> </ul> </p> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/viewport-scrollbar.html" title="css/css-scrollbars/viewport-scrollbar.html">viewport-scrollbar.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/viewport-scrollbar.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/viewport-scrollbar.html"><small>(source)</small></a> </ul> <hr> </details> <p class="note" role="note"><span class="marker">Note:</span> Unlike <a class="property css" data-link-type="property" href="https://drafts.csswg.org/css-overflow-3/#propdef-overflow" id="ref-for-propdef-overflow">overflow</a> (and overflow-*) properties, scrollbar-color value set on the HTML body element are not propagated to the viewport.</p> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/viewport-scrollbar-body.html" title="css/css-scrollbars/viewport-scrollbar-body.html">viewport-scrollbar-body.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/viewport-scrollbar-body.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/viewport-scrollbar-body.html"><small>(source)</small></a> </ul> </details> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="scrollbar-color" data-dfn-type="value" data-export id="valdef-scrollbar-color-auto">auto</dfn> <dd> The user agent determines the colors of the scrollbar. It should follow platform conventions, but may adjust the colors in accordance with <a class="property css" data-link-type="property" href="https://drafts.csswg.org/css-color-adjust-1/#propdef-color-scheme" id="ref-for-propdef-color-scheme">color-scheme</a> or other contextual information to better suit the page. <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>These tests check that that if the scrollbar adjusts based on the color scheme, then dynamic updates to the color scheme do cause an update of the scrollbar's colors.</p> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-scheme-dynamic-1.html" title="css/css-scrollbars/scrollbar-color-scheme-dynamic-1.html">scrollbar-color-scheme-dynamic-1.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-scheme-dynamic-1.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-scheme-dynamic-1.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-scheme-dynamic-2.html" title="css/css-scrollbars/scrollbar-color-scheme-dynamic-2.html">scrollbar-color-scheme-dynamic-2.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-scheme-dynamic-2.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-scheme-dynamic-2.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-scheme-dynamic-3.html" title="css/css-scrollbars/scrollbar-color-scheme-dynamic-3.html">scrollbar-color-scheme-dynamic-3.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-scheme-dynamic-3.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-scheme-dynamic-3.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-scheme-dynamic-4.html" title="css/css-scrollbars/scrollbar-color-scheme-dynamic-4.html">scrollbar-color-scheme-dynamic-4.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-scheme-dynamic-4.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-scheme-dynamic-4.html"><small>(source)</small></a> </ul> <hr> </details> <dt><dfn class="dfn-paneled css" data-dfn-for="scrollbar-color" data-dfn-type="value" data-export id="valdef-scrollbar-color-color"><a class="production css" data-link-type="type" href="https://drafts.csswg.org/css-color-5/#typedef-color" id="ref-for-typedef-color①"><color></a></dfn> <dd> The user agent should use the specified colors to adjust the rendering of the element’s scollbars, if any, applying the first color to the <a data-link-type="dfn" href="#thumb" id="ref-for-thumb">thumb</a> of the scrollbar, and the second color to the <a data-link-type="dfn" href="#track" id="ref-for-track">track</a> of the scrollbar. </dl> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="track">track</dfn> refers to the background of the scrollbar, which is generally fixed regardless of the scrolling position.</p> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="thumb">thumb</dfn> refers to the moving part of the scrollbar, which usually floats on top of the <a data-link-type="dfn" href="#track" id="ref-for-track①">track</a>.</p> <p>Some scrollbars also include additional controls, refered to as <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="buttons">buttons</dfn>, which usually sit at the top or bottom of the scrollbar on top of the <a data-link-type="dfn" href="#track" id="ref-for-track②">track</a>. This specification does not define whether and how buttons—if present—are colored.</p> <figure> <img alt="A vertical scrollbar with a 'scroll-up' button at the top containing an upwards triangle, a 'scroll-down' button at the top containing an downwards triangle, a movable thumb indicating that the scrollar is all the way to the top, all over a background track. Each of these parts is labeled." height="129" src="images/parts.svg" width="270"> <figcaption>Anatomy of a scrollbar</figcaption> </figure> <p>If this property computes to a value other than <a class="css" data-link-type="maybe" href="#valdef-scrollbar-color-auto" id="ref-for-valdef-scrollbar-color-auto">auto</a>, implementations may render a simpler scrollbar than the default platform UI rendering, and color it accordingly.</p> <p class="note" role="note"><span class="marker">Note:</span> Sometimes the UA is unable to customize the colors of native scrollbars, perhaps due to how they’re structured, or to a lack of control given by the native toolkit. The provision above allows the UA to replace them with differently-constructed scrollbars, which it does know how to color.</p> <p class="note" role="note"><span class="marker">Note:</span> User Agents are expected to use the color in the rendering of the scrollbar, but that does not imply they need to paint the entire thumb or track with a single solid featureless color. The specified color can be used as a tint for part of the component, lighter or darker shades of the color can be used for highlights, shadows, texture…</p> <div class="example" id="non-flat"> <a class="self-link" href="#non-flat"></a> The following image represents a possible rendition of a scrollbar given the following css: <pre><code class="highlight"><c- k>scrollbar-color</c-><c- p>:</c-> #8eb0dc #d2d4d6<c- p>;</c-></code></pre> <p>This specific design is not only that single shade of blue over that single shade of gray: the <a data-link-type="dfn" href="#thumb" id="ref-for-thumb①">thumb</a> has a subtle vertical gradient going from a lighter shade at the top to a slightly darker shade at the bottom, darker notches in the middle, as well as a darker outline, all derived from the specified shade of blue; the light gray <a data-link-type="dfn" href="#track" id="ref-for-track③">track</a> has a darker outline. This design also happens to include <a data-link-type="dfn" href="#buttons" id="ref-for-buttons">buttons</a>.</p> <p><img alt="A horizontal scrollbar with a textured, shaded and outlined blue thumb, over a light gray track which is itself outlined, and flanked by two 'scroll left' and 'scroll right' buttons, as was commonly seen in scrollbar designs of the early 2000s" height="17" src="images/non-flat-bar.png" width="318"></p> <p>Nevertheless, authors cannot assume that this will necessarily be the case, as on a different platform or a different user agent the rendering could be a solid color <a data-link-type="dfn" href="#thumb" id="ref-for-thumb②">thumb</a> over a solid color <a data-link-type="dfn" href="#track" id="ref-for-track④">track</a>, as seen below.</p> <p><img alt="A horizontal scrollbar with a blue featureless rounded rectangle as a thumb over a featureless light gray track, as was commonly seen in scrollbar designs of the early 2020s" height="15" src="images/flat-bar.png" width="318"></p> </div> <p>Implementations may ignore any of the colors if the corresponding part do not exist on the underlying platform.</p> <p>When using <a class="property css" data-link-type="property" href="#propdef-scrollbar-color" id="ref-for-propdef-scrollbar-color②">scrollbar-color</a> property with specific color values, authors should ensure the specified colors have enough contrast between them. For the <a class="css" data-link-type="maybe" href="#valdef-scrollbar-color-auto" id="ref-for-valdef-scrollbar-color-auto①">auto</a> value, UAs should ensure the colors they use have enough contrast. See <a href="https://www.w3.org/TR/WCAG21/#non-text-contrast">WCAG 2.1 SC 1.4.11 Non-text Contrast</a> <a data-link-type="biblio" href="#biblio-wcag21" title="Web Content Accessibility Guidelines (WCAG) 2.1">[WCAG21]</a>. UAs may ignore these contrast requirements based on explicit user preferences (for example, when users choose a configuration option/setting that always ensures a particular scrollbar color / use of system default scrollbars).</p> <p class="note" role="note"><span class="marker">Note:</span> Implementations can take advantage of the fact that they have full discretion in how to apply the specified colors in order to visually respond to user interactions with the scrollbar (e.g. hovering or activating): they could alter which scrollbar parts the specified colors apply to, use darker or lighter shades of the specified colors, more or less saturated variants…</p> <p>If the user agent displays the scrollbar without the <a data-link-type="dfn" href="#track" id="ref-for-track⑤">track</a>, they must ensure reasonable contrast between the <a data-link-type="dfn" href="#thumb" id="ref-for-thumb③">thumb</a> and what is behind it. However, if the author set the color of the <span id="ref-for-track⑥">track</span> to be fully transparent, the user agent may assume that the author has provided for sufficient contrast even with an invisible track.</p> <p class="note" role="note"><span class="marker">Note:</span> This is typically relevant in the case of <a data-link-type="dfn" href="https://drafts.csswg.org/css-overflow-3/#overlay-scrollbars" id="ref-for-overlay-scrollbars">overlay scrollbars</a>, either on platforms where the <a data-link-type="dfn" href="#track" id="ref-for-track⑦">track</a> is never displayed, or on platforms where it is only displayed when the scrollbar is being interacted with but not when scrolling with the mouse wheel or the track-pad. This does not apply in cases where the entire scrollbar is hidden as is often the case with <span id="ref-for-overlay-scrollbars①">overlay scrollbars</span> while no scroll operation is ongoing <em>and</em> when the scrollbar is not being interacted with either.</p> <div class="note" role="note"> Note: The user agent is free to achieve this by any of a variety of means, depending on the platform, on design choices, or on what is practical to implement, such as: <ul> <li data-md> <p>Doing nothing if it can determine that contrast is already sufficient</p> <li data-md> <p>Doing nothing if the design and geometry of the thumb ensures that some part of it will always be visible regardless of what is behind it</p> <li data-md> <p>Adding an outline, shadow, or glow around the <a data-link-type="dfn" href="#thumb" id="ref-for-thumb④">thumb</a> to provide contrast (possibly using the <a data-link-type="dfn" href="#track" id="ref-for-track⑧">track</a> color as the contrasting color, or possibly using a different shade of the <span id="ref-for-thumb⑤">thumb</span> color)</p> <li data-md> <p>Adding some texture or geometry to the <a data-link-type="dfn" href="#thumb" id="ref-for-thumb⑥">thumb</a> so that it’s color isn’t uniform</p> <li data-md> <p>Drawing the <a data-link-type="dfn" href="#track" id="ref-for-track⑨">track</a> anyway in cases where not doing so yields insufficient contrast</p> <li data-md> <p>Replacing the <a data-link-type="dfn" href="#thumb" id="ref-for-thumb⑦">thumb</a> color with the <a data-link-type="dfn" href="#track" id="ref-for-track①⓪">track</a> color when that provides better contrast</p> <li data-md> <p>Altering the luminosity of the specified <a data-link-type="dfn" href="#thumb" id="ref-for-thumb⑧">thumb</a> color while preserving its hue</p> <li data-md> <p>Disregarding the specified <a data-link-type="dfn" href="#thumb" id="ref-for-thumb⑨">thumb</a> color altogether and use automatically determined alternative</p> </ul> </div> <h3 class="heading settled" data-level="2.1" id="color-compat"><span class="secno">2.1. </span><span class="content"> Interaction with non-standard features</span><a class="self-link" href="#color-compat"></a></h3> <p>On any element or <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#pseudo-element" id="ref-for-pseudo-element">pseudo-element</a> where the <a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-5/#computed-value" id="ref-for-computed-value">computed value</a> of <a class="property css" data-link-type="property" href="#propdef-scrollbar-color" id="ref-for-propdef-scrollbar-color③">scrollbar-color</a> is anything other than the initial <a class="css" data-link-type="maybe" href="#valdef-scrollbar-color-auto" id="ref-for-valdef-scrollbar-color-auto②">auto</a> value, user agents must ignore any alternative non-standard means for authors to influence the rendering of scrollbars, <span class="non-normative">such as the <span class="css">::webkit-scrollbar</span> family of <a data-link-type="dfn" href="https://www.w3.org/TR/CSS2/selector.html#x22" id="ref-for-x22">pseudo-elements</a></span>.</p> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-001.html" title="css/css-scrollbars/scrollbar-color-001.html">scrollbar-color-001.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-001.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-001.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-002.html" title="css/css-scrollbars/scrollbar-color-002.html">scrollbar-color-002.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-002.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-003.html" title="css/css-scrollbars/scrollbar-color-003.html">scrollbar-color-003.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-003.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-003.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-004.html" title="css/css-scrollbars/scrollbar-color-004.html">scrollbar-color-004.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-004.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-004.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-005.html" title="css/css-scrollbars/scrollbar-color-005.html">scrollbar-color-005.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-005.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-005.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-006.html" title="css/css-scrollbars/scrollbar-color-006.html">scrollbar-color-006.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-006.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-006.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-007.html" title="css/css-scrollbars/scrollbar-color-007.html">scrollbar-color-007.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-007.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-007.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-008.html" title="css/css-scrollbars/scrollbar-color-008.html">scrollbar-color-008.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-008.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-008.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-009.html" title="css/css-scrollbars/scrollbar-color-009.html">scrollbar-color-009.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-009.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-009.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-010.html" title="css/css-scrollbars/scrollbar-color-010.html">scrollbar-color-010.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-010.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-010.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-color-dynamic-8.html" title="css/css-scrollbars/scrollbar-color-dynamic-8.html">scrollbar-color-dynamic-8.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-color-dynamic-8.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-color-dynamic-8.html"><small>(source)</small></a> </ul> </details> <h2 class="heading settled" data-level="3" id="scrollbar-width"><span class="secno">3. </span><span class="content">Scrollbar Thickness: the <a class="property css" data-link-type="property" href="#propdef-scrollbar-width" id="ref-for-propdef-scrollbar-width①">scrollbar-width</a> property</span><a class="self-link" href="#scrollbar-width"></a></h2> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p> This section has partial test coverage. <p>Missing:</p> <ul> <li data-md> <p>Test that thin does something different from auto in at least some cases</p> <li data-md> <p>Test that none does not affect scrollability</p> <li data-md> <p>Initial value</p> </ul> </p> <ul class="wpt-tests-list"></ul> <hr> </details> <table class="def propdef" data-link-for-hint="scrollbar-width"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-scrollbar-width">scrollbar-width</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod">auto <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one①">|</a> thin <span id="ref-for-comb-one②">|</span> none <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>auto <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td><a data-link-type="dfn" href="https://drafts.csswg.org/css-overflow-3/#scroll-container" id="ref-for-scroll-container①">scroll containers</a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>n/a <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>specified keyword <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>discrete </table> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/inheritance.html" title="css/css-scrollbars/inheritance.html">inheritance.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/inheritance.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/inheritance.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-parsing.html" title="css/css-scrollbars/scrollbar-width-parsing.html">scrollbar-width-parsing.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-parsing.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-parsing.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/textarea-scrollbar-width-none.html" title="css/css-scrollbars/textarea-scrollbar-width-none.html">textarea-scrollbar-width-none.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/textarea-scrollbar-width-none.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/textarea-scrollbar-width-none.html"><small>(source)</small></a> </ul> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/web-animations/animation-model/animation-types/interpolation-per-property-002.html" title="web-animations/animation-model/animation-types/interpolation-per-property-002.html">interpolation-per-property-002.html</a> <a class="wpt-live" href="http://wpt.live/web-animations/animation-model/animation-types/interpolation-per-property-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/web-animations/animation-model/animation-types/interpolation-per-property-002.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/web-animations/animation-model/animation-types/addition-per-property-002.html" title="web-animations/animation-model/animation-types/addition-per-property-002.html">addition-per-property-002.html</a> <a class="wpt-live" href="http://wpt.live/web-animations/animation-model/animation-types/addition-per-property-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/web-animations/animation-model/animation-types/addition-per-property-002.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/web-animations/animation-model/animation-types/accumulation-per-property-002.html" title="web-animations/animation-model/animation-types/accumulation-per-property-002.html">accumulation-per-property-002.html</a> <a class="wpt-live" href="http://wpt.live/web-animations/animation-model/animation-types/accumulation-per-property-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/web-animations/animation-model/animation-types/accumulation-per-property-002.html"><small>(source)</small></a> </ul> </details> <p>This property allows the author to specify the desired thickness of an element’s scrollbars.</p> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-paint-001.html" title="css/css-scrollbars/scrollbar-width-paint-001.html">scrollbar-width-paint-001.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-paint-001.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-paint-001.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-paint-002.html" title="css/css-scrollbars/scrollbar-width-paint-002.html">scrollbar-width-paint-002.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-paint-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-paint-002.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-paint-003.html" title="css/css-scrollbars/scrollbar-width-paint-003.html">scrollbar-width-paint-003.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-paint-003.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-paint-003.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-paint-004.html" title="css/css-scrollbars/scrollbar-width-paint-004.html">scrollbar-width-paint-004.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-paint-004.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-paint-004.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-paint-005.html" title="css/css-scrollbars/scrollbar-width-paint-005.html">scrollbar-width-paint-005.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-paint-005.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-paint-005.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-paint-006.html" title="css/css-scrollbars/scrollbar-width-paint-006.html">scrollbar-width-paint-006.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-paint-006.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-paint-006.html"><small>(source)</small></a> </ul> </details> <div class="advisement"> The primary purpose of this property is not to allow authors to choose 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. <p>Scrollbars are a UI mechanism essential to interact with the page. Operating systems tend to want consistency in such controls to improve usability through familiarity, and users with specific preferences or needs can adjust the appearance of various UI components, including scrollbars, through OS or UA settings.</p> <p>While using this property in support of specific UX goals is appropriate, authors should otherwise refrain from overriding such user preferences.</p> </div> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="scrollbar-width" data-dfn-type="value" data-export id="valdef-scrollbar-width-auto">auto</dfn> <dd> Implementations must use the default scrollbar width. <p class="note" role="note"><span class="marker">Note:</span> On most systems, this corresponds to the traditional somewhat wide scrollbar. However, through OS or UA settings, users can have the ability to change what this default corresponds to, possibly making the default scrollbar wider or narrower than is typical.</p> <dt><dfn class="dfn-paneled css" data-dfn-for="scrollbar-width" data-dfn-type="value" data-export id="valdef-scrollbar-width-thin">thin</dfn> <dd> Implementations should use thinner scrollbars than <a class="css" data-link-type="maybe" href="#valdef-scrollbar-width-auto" id="ref-for-valdef-scrollbar-width-auto">auto</a>. This may mean a thin variant of scrollbar provided by the platform, or a custom scrollbar thinner than the default platform scrollbar. The scrollbar must nonetheless remain wide enough to be usable. (Implementers may wish to consult <a href="https://www.w3.org/TR/WCAG21/#target-size">WCAG 2.1 SC 2.5.5 Target Size</a>. <a data-link-type="biblio" href="#biblio-wcag21" title="Web Content Accessibility Guidelines (WCAG) 2.1">[WCAG21]</a>) <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-keywords.html" title="css/css-scrollbars/scrollbar-width-keywords.html">scrollbar-width-keywords.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-keywords.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-keywords.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-001.html" title="css/css-scrollbars/scrollbar-width-001.html">scrollbar-width-001.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-001.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-001.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-002.html" title="css/css-scrollbars/scrollbar-width-002.html">scrollbar-width-002.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-002.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-003.html" title="css/css-scrollbars/scrollbar-width-003.html">scrollbar-width-003.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-003.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-003.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-004.html" title="css/css-scrollbars/scrollbar-width-004.html">scrollbar-width-004.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-004.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-004.html"><small>(source)</small></a> </ul> </details> <p class="note" role="note"><span class="marker">Note:</span> User agents can use various strategies to ensure the usability of narrow scrollbars. For instance, in the case of <a data-link-type="dfn" href="https://drafts.csswg.org/css-overflow-3/#overlay-scrollbars" id="ref-for-overlay-scrollbars②">overlay scrollbars</a>, they can dynamically enlarge the scrollbar in response to a user attempting to interact with it. User agents on devices with touch screens can also adjust how they interpret finger taps to facilitate interacting with visually small touch targets.</p> <p>User agents may disregard this value and treat it as <a class="css" data-link-type="maybe" href="#valdef-scrollbar-width-auto" id="ref-for-valdef-scrollbar-width-auto①">auto</a>, for instance when the user has indicated discomfort for thin scrollbars through some UA or OS setting. (User agents are encouraged to provide such a setting.)</p> <p class="note" role="note"><span class="marker">Note:</span> Some platforms only have a tiny scrollbar by default which cannot be reasonably made thinner. In such cases, this value will behave as <a class="css" data-link-type="maybe" href="#valdef-scrollbar-width-auto" id="ref-for-valdef-scrollbar-width-auto②">auto</a>.</p> <dt><dfn class="dfn-paneled css" data-dfn-for="scrollbar-width" data-dfn-type="value" data-export id="valdef-scrollbar-width-none">none</dfn> <dd> Implementations must not display any scrollbar, however the element’s scrollability by other means is not affected. <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/textarea-scrollbar-width-none.html" title="css/css-scrollbars/textarea-scrollbar-width-none.html">textarea-scrollbar-width-none.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/textarea-scrollbar-width-none.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/textarea-scrollbar-width-none.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-keywords.html" title="css/css-scrollbars/scrollbar-width-keywords.html">scrollbar-width-keywords.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-keywords.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-keywords.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-001.html" title="css/css-scrollbars/scrollbar-width-001.html">scrollbar-width-001.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-001.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-001.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-002.html" title="css/css-scrollbars/scrollbar-width-002.html">scrollbar-width-002.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-002.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-002.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-003.html" title="css/css-scrollbars/scrollbar-width-003.html">scrollbar-width-003.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-003.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-003.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-004.html" title="css/css-scrollbars/scrollbar-width-004.html">scrollbar-width-004.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-004.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-004.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-007.html" title="css/css-scrollbars/scrollbar-width-007.html">scrollbar-width-007.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-007.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-007.html"><small>(source)</small></a> </ul> </details> <div class="advisement"> Using this value can prevent mouse-only users from being able to scroll. Authors should ensure that mouse-only users can still reach hidden content, even if they have no scrollwheel. </div> <div class="advisement"> Authors that use <a class="css" data-link-type="maybe" href="#valdef-scrollbar-width-none" id="ref-for-valdef-scrollbar-width-none">none</a> should provide an alternative/equivalent visual hint that scrolling is possible and there is more content. </div> <p class="note" role="note"><span class="marker">Note:</span> For situations where an element is to be scrolled <em>only</em> by programmatic means, and not by direct user manipulation, <a class="css" data-link-type="propdesc" href="https://drafts.csswg.org/css-overflow-3/#propdef-overflow" id="ref-for-propdef-overflow①">overflow: hidden</a> is appropriate, not <a class="css" data-link-type="propdesc" href="#propdef-scrollbar-width" id="ref-for-propdef-scrollbar-width②">scrollbar-width: none</a>.</p> </dl> <div class="note" role="note"> Note: Users who find the <a class="css" data-link-type="maybe" href="#valdef-scrollbar-width-thin" id="ref-for-valdef-scrollbar-width-thin">thin</a> style of scrollbars unusable can include the following rule in their <a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-5/#cascade-origin-user" id="ref-for-cascade-origin-user">user style sheet</a>: <pre><code class="lang-css highlight">* <c- p>{</c-> <c- k>scrollbar-width</c-><c- p>:</c-> auto !important<c- p>;</c-> <c- p>}</c-></code></pre> <p>This will ensure that all scrollbars are sized as per OS and UA settings regardless of author styles.</p> </div> <p>UAs must apply the <a class="property css" data-link-type="property" href="#propdef-scrollbar-width" id="ref-for-propdef-scrollbar-width③">scrollbar-width</a> value set on the root element to the viewport.</p> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-005.html" title="css/css-scrollbars/scrollbar-width-005.html">scrollbar-width-005.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-005.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-005.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-006.html" title="css/css-scrollbars/scrollbar-width-006.html">scrollbar-width-006.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-006.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-006.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-007.html" title="css/css-scrollbars/scrollbar-width-007.html">scrollbar-width-007.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-007.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-007.html"><small>(source)</small></a> </ul> </details> <p class="note" role="note"><span class="marker">Note:</span> Unlike the <a class="property css" data-link-type="property" href="https://drafts.csswg.org/css-overflow-3/#propdef-overflow" id="ref-for-propdef-overflow②">overflow</a> property (and its longhands), a <a class="property css" data-link-type="property" href="#propdef-scrollbar-width" id="ref-for-propdef-scrollbar-width④">scrollbar-width</a> value set on the HTML <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/sections.html#the-body-element" id="ref-for-the-body-element">body</a></code> element is not propagated to the viewport.</p> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-008.html" title="css/css-scrollbars/scrollbar-width-008.html">scrollbar-width-008.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-008.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-008.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-009.html" title="css/css-scrollbars/scrollbar-width-009.html">scrollbar-width-009.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-009.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-009.html"><small>(source)</small></a> </ul> </details> <p class="note" role="note"><span class="marker">Note:</span> This specification does not define the exact position or shape of the scrollbar, or any animation thereof, such as fading or sliding in/out of view.</p> <h3 class="heading settled" data-level="3.1" id="width-compat"><span class="secno">3.1. </span><span class="content"> Interaction with non-standard features</span><a class="self-link" href="#width-compat"></a></h3> <p>On any element or <a data-link-type="dfn" href="https://drafts.csswg.org/selectors-4/#pseudo-element" id="ref-for-pseudo-element①">pseudo-element</a> where the <a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-5/#computed-value" id="ref-for-computed-value①">computed value</a> of <a class="property css" data-link-type="property" href="#propdef-scrollbar-width" id="ref-for-propdef-scrollbar-width⑤">scrollbar-width</a> is anything other than the initial <a class="css" data-link-type="maybe" href="#valdef-scrollbar-width-auto" id="ref-for-valdef-scrollbar-width-auto③">auto</a> value, user agents must ignore any alternative non-standard means for authors to influence the rendering of scrollbars, <span class="non-normative">such as the <span class="css">::webkit-scrollbar</span> family of <a data-link-type="dfn" href="https://www.w3.org/TR/CSS2/selector.html#x22" id="ref-for-x22①">pseudo-elements</a></span>.</p> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <ul class="wpt-tests-list"> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-010.html" title="css/css-scrollbars/scrollbar-width-010.html">scrollbar-width-010.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-010.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-010.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-011.html" title="css/css-scrollbars/scrollbar-width-011.html">scrollbar-width-011.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-011.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-011.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-012.html" title="css/css-scrollbars/scrollbar-width-012.html">scrollbar-width-012.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-012.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-012.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-013.html" title="css/css-scrollbars/scrollbar-width-013.html">scrollbar-width-013.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-013.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-013.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-014.html" title="css/css-scrollbars/scrollbar-width-014.html">scrollbar-width-014.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-014.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-014.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-015.html" title="css/css-scrollbars/scrollbar-width-015.html">scrollbar-width-015.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-015.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-015.html"><small>(source)</small></a> <li class="wpt-test"><a class="wpt-name" href="https://wpt.fyi/results/css/css-scrollbars/scrollbar-width-016.html" title="css/css-scrollbars/scrollbar-width-016.html">scrollbar-width-016.html</a> <a class="wpt-live" href="http://wpt.live/css/css-scrollbars/scrollbar-width-016.html"><small>(live test)</small></a> <a class="wpt-source" href="https://github.com/web-platform-tests/wpt/blob/master/css/css-scrollbars/scrollbar-width-016.html"><small>(source)</small></a> </ul> </details> <h2 class="no-num heading settled" id="acknowledgments"><span class="content"> Appendix A. Acknowledgments</span><a class="self-link" href="#acknowledgments"></a></h2> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>This appendix is <em>non-normative</em>.</p> <p>The CSS Working Group and the Editors of this specification would like to express our gratitude to the following people, as this specification would not have been possible without their feedback and contributions: Chris Lilley, Emilio Cobos Álvarez, Eric Shepherd, Eric Willigers, fantasai, Greg Whitworth, jonjohnjohnson, L. David Baron, Luke Warlow, Oriol Brufau, Patrick H. Lauke, Rene Haas, Rick Byers, Simon Fraser, Tab Atkins Jr., Xidorn Quan. </p> <p> In particular, thanks for the use-cases, prototyping, implementation, and feedback from <a class="h-card" href="https://xanthir.com/">Tab Atkins</a> and <a class="h-card" href="https://www.upsuper.org/">Xidorn Quan</a>. Thanks for accessibility review and contributions (<a href="https://github.com/w3c/csswg-drafts/issues/3315">#3315</a>) from <a class="h-card" href="https://www.splintered.co.uk">Patrick H. Lauke</a>. </p> <h2 class="no-num heading settled" id="changes"><span class="content"> Appendix B. Changes</span><a class="self-link" href="#changes"></a></h2> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>This appendix is <em>non-normative</em>.</p> <h3 class="no-num heading settled" id="changes-since-2021-12-09"><span class="content"> Changes since the <a href="https://www.w3.org/TR/2021/CR-css-scrollbars-1-20211200/">9 December 2021 Candidate Recommendation</a></span><span id="changes-since-2021-12-06"></span><a class="self-link" href="#changes-since-2021-12-09"></a></h3> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <ul> <li data-md> <p>Switched the Animation type of <a class="property css" data-link-type="property" href="#propdef-scrollbar-width" id="ref-for-propdef-scrollbar-width⑥">scrollbar-width</a> to <a data-link-type="dfn" href="https://drafts.csswg.org/web-animations-1/#discrete" id="ref-for-discrete">discrete</a>, reflecting the fact that this property only takes keyword values.</p> </ul> <h3 class="no-num heading settled" id="changes-since-2021-12-02"><span class="content"> Changes since the <a href="https://www.w3.org/TR/css-scrollbars-1/">2021-12-02 Working Draft</a></span><a class="self-link" href="#changes-since-2021-12-02"></a></h3> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <ul> <li data-md> <p>Boilerplate changes for CR</p> </ul> <h3 class="no-num heading settled" id="changes-since-2021-08-05"><span class="content"> Changes from the <a href="https://www.w3.org/TR/2021/WD-css-scrollbars-1-20210805/">2021-08-05 Working Draft</a></span><a class="self-link" href="#changes-since-2021-08-05"></a></h3> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <ul> <li data-md> <p>Switched "should" to a "must" with regards to accessibility of narrow scrollbars. (see <a href="https://github.com/w3c/csswg-drafts/issues/6675">Issue 6675</a>)</p> </ul> <h3 class="no-num heading settled" id="changes-since-2018-09-25"><span class="content"> Changes from the <a href="https://www.w3.org/TR/2018/WD-css-scrollbars-1-20180925/">2018-09-25 First Public Working Draft</a></span><a class="self-link" href="#changes-since-2018-09-25"></a></h3> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <ul> <li><a href="https://github.com/w3c/csswg-drafts/issues/6438">#6538</a>: removed <span class="css">light</span> and <span class="css">dark</span> values of <a class="property css" data-link-type="property" href="#propdef-scrollbar-color" id="ref-for-propdef-scrollbar-color④">scrollbar-color</a> in favor of allowing the UA to tune <a class="css" data-link-type="maybe" href="#valdef-scrollbar-color-auto" id="ref-for-valdef-scrollbar-color-auto③">auto</a> in accordance with <a class="property css" data-link-type="property" href="https://drafts.csswg.org/css-color-adjust-1/#propdef-color-scheme" id="ref-for-propdef-color-scheme①">color-scheme</a> or other contextual information. <li><a href="https://github.com/w3c/csswg-drafts/issues/3237">#3237</a>: scrollbar-color computed value changed to: specified keyword or two computed colors <li><a href="https://github.com/w3c/csswg-drafts/issues/4693">#4693</a>: Clarified scope: styling scrollbar controls themselves, no layout or scrollability. <li><a href="https://github.com/w3c/csswg-drafts/issues/3315">#3315</a>: More and updated accessibility considerations for scrollbar-color and scrollbar-width. </ul> <h2 class="no-num heading settled" id="security-privacy-considerations"><span class="content"> Appendix C. Security and Privacy</span><a class="self-link" href="#security-privacy-considerations"></a></h2> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>This appendix is <em>non-normative</em>.</p> <h3 class="no-num heading settled" id="security-considerations"><span class="content"> Considerations for Security</span><a class="self-link" href="#security-considerations"></a></h3> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>No specific concerns regarding security have been identified for this specification.</p> <h3 class="no-num heading settled" id="privacy-considerations"><span class="content"> Considerations for Privacy</span><a class="self-link" href="#privacy-considerations"></a></h3> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>No specific concerns regarding privacy have been identified for this specification.</p> <h3 class="no-num heading settled" id="security-privacy-self-review"><span class="content"> Self-review questionnaire</span><a class="self-link" href="#security-privacy-self-review"></a></h3> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>Per the <a href="https://www.w3.org/TR/security-privacy-questionnaire/#questions"> Self-Review Questionnaire: Security and Privacy: Questions to Consider</a></p> <ol> <li> Does this specification deal with personally-identifiable information? <p>No. </p> <li> Does this specification deal with high-value data? <p>No. </p> <li> Does this specification introduce new state for an origin that persists across browsing sessions? <p>No. </p> <li> Does this specification expose persistent, cross-origin state to the web? <p>No. </p> <li> Does this specification expose any other data to an origin that it doesn’t currently have access to? <p>No. </p> <li> Does this specification enable new script execution/loading mechanisms? <p>No. </p> <li> Does this specification allow an origin access to a user’s location? <p>No. </p> <li> Does this specification allow an origin access to sensors on a user’s device? <p>No. </p> <li> Does this specification allow an origin access to aspects of a user’s local computing environment? <p>No. </p> <li> Does this specification allow an origin access to other devices? <p>No. </p> <li> Does this specification allow an origin some measure of control over a user agent’s native UI? <p>Yes. The <span class="css">scrollbar-*</span> properties enable the page to change the color and width of the scrollbar of the user agent’s native UI, e.g. scrollbars on the page’s window, on framed content embedded in the page, or on overflowing elements with scrollbars in the page. </p> <li> Does this specification expose temporary identifiers to the web? <p>No. </p> <li> Does this specification distinguish between behavior in first-party and third-party contexts? <p>No. </p> <li> How should this specification work in the context of a user agent’s "incognito" mode? <p>No differently. </p> <li> Does this specification persist data to a user’s local device? <p>No. </p> <li> Does this specification have a "Security Considerations" and "Privacy Considerations" section? <p>Yes. </p> <li> Does this specification allow downgrading default security characteristics? <p>No. </p> </ol> <h2 class="no-num heading settled" id="accessibility-considerations"><span class="content"> Appendix D. Considerations for accessibility</span><a class="self-link" href="#accessibility-considerations"></a></h2> <details class="wpt-tests-block" dir="ltr" lang="en"> <summary>Tests</summary> <p>This section is not normative, it does not need tests.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <p>This appendix is <em>non-normative</em>.</p> <div class="informative"> As noted <a href="#scrollbar-width">in the definition of the property</a>, authors need to be mindful of the accessibility implications of using <a class="css" data-link-type="propdesc" href="#propdef-scrollbar-width" id="ref-for-propdef-scrollbar-width⑦">scrollbar-width: thin</a>. Scrollbars are a important piece of the user agent’s interface, and it is not appropriate for a web site author to change their size over aesthetic considerations. The property is available to support cases where the author wants to indicate that in a cramped area of the web page a thin scrollbar would be a more effective use of space. However, ultimately, the user, through their user agent, needs to have the last word on such things. <p>Using this property in such cases is preferable to authors building a custom thin-looking scrollbar in via script or proprietary extensions, because it does give the user the opportunity to override it.</p> <p><a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-5/#cascade-origin-user" id="ref-for-cascade-origin-user①">User style sheets</a> do provide such an override, and additionally, user agents are encouraged to expose a setting letting users express that they do not want thin scrollbars to be used.</p> <p>The CSS Working Group also acknowledges the needs of some users to have scrollbars that are wider than is typical. Operating systems and user agents can offer a means to let users express that preference, and in such cases, CSS will honor that choice.</p> </div> </main> <h2 class="no-ref no-num heading settled" id="w3c-conformance"><span class="content"> Conformance</span><a class="self-link" href="#w3c-conformance"></a></h2> <h3 class="no-ref heading settled" id="w3c-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#w3c-conventions"></a></h3> <p>Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification. </p> <p>All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119" title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</a></p> <p>Examples in this specification are introduced with the words “for example” or are set apart from the normative text with <code>class="example"</code>, like this: </p> <div class="example" id="w3c-example"> <a class="self-link" href="#w3c-example"></a> <p>This is an example of an informative example.</p> </div> <p>Informative notes begin with the word “Note” and are set apart from the normative text with <code>class="note"</code>, like this: </p> <p class="note" role="note">Note, this is an informative note.</p> <p>Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <code><strong class="advisement"></code>, like this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong></p> <details class="wpt-tests-block" dir="ltr" lang="en" open> <summary>Tests</summary> <p>Tests relating to the content of this specification may be documented in “Tests” blocks like this one. Any such block is non-normative.</p> <ul class="wpt-tests-list"></ul> <hr> </details> <h3 class="no-ref heading settled" id="w3c-conformance-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#w3c-conformance-classes"></a></h3> <p>Conformance to this specification is defined for three conformance classes: </p> <dl> <dt>style sheet <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS style sheet</a>. <dt>renderer <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders documents that use them. <dt>authoring tool <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that writes a style sheet. </dl> <p>A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module. </p> <p>A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.) </p> <p>An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module. </p> <h3 class="no-ref heading settled" id="w3c-partial"><span class="content"> Partial implementations</span><a class="self-link" href="#w3c-partial"></a></h3> <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers <strong>must</strong> treat as invalid (and <a href="https://www.w3.org/TR/CSS21/conform.html#ignore">ignore as appropriate</a>) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents <strong>must not</strong> selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.</p> <h4 class="heading settled" id="w3c-conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#w3c-conform-future-proofing"></a></h4> <p>To avoid clashes with future stable CSS features, the CSSWG recommends <a href="https://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="https://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="https://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p> <h3 class="no-ref heading settled" id="w3c-testing"><span class="content"> Non-experimental implementations</span><a class="self-link" href="#w3c-testing"></a></h3> <p>Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec. </p> <p>To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group. </p> <p>Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at <a href="https://www.w3.org/Style/CSS/Test/">https://www.w3.org/Style/CSS/Test/</a>. Questions should be directed to the <a href="https://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list.</p> <script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script> <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2> <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3> <ul class="index"> <li> auto <ul> <li><a href="#valdef-scrollbar-color-auto">value for scrollbar-color</a><span>, in § 2</span> <li><a href="#valdef-scrollbar-width-auto">value for scrollbar-width</a><span>, in § 3</span> </ul> <li><a href="#buttons">buttons</a><span>, in § 2</span> <li><a href="#valdef-scrollbar-color-color"><color></a><span>, in § 2</span> <li><a href="#valdef-scrollbar-width-none">none</a><span>, in § 3</span> <li><a href="#propdef-scrollbar-color">scrollbar-color</a><span>, in § 2</span> <li><a href="#propdef-scrollbar-width">scrollbar-width</a><span>, in § 3</span> <li><a href="#valdef-scrollbar-width-thin">thin</a><span>, in § 3</span> <li><a href="#thumb">thumb</a><span>, in § 2</span> <li><a href="#track">track</a><span>, in § 2</span> </ul> <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3> <ul class="index"> <li> <a data-link-type="biblio">[CSS-CASCADE-5]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="9cd25054">computed value</span> <li><span class="dfn-paneled" id="6e779122">user style sheet</span> </ul> <li> <a data-link-type="biblio">[CSS-COLOR-5]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="1548047a"><color></span> </ul> <li> <a data-link-type="biblio">[CSS-COLOR-ADJUST-1]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="c373c5f8">color-scheme</span> </ul> <li> <a data-link-type="biblio">[CSS-OVERFLOW-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="86928bde">overflow</span> <li><span class="dfn-paneled" id="884d81d3">overlay scrollbars</span> <li><span class="dfn-paneled" id="86923d07">scroll container</span> </ul> <li> <a data-link-type="biblio">[CSS-VALUES-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="358fd6ff">CSS-wide keywords</span> <li><span class="dfn-paneled" id="b0d8ebd9">{A}</span> <li><span class="dfn-paneled" id="6ec67710">|</span> </ul> <li> <a data-link-type="biblio">[CSS2]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="7b82c9e5">pseudo-elements</span> </ul> <li> <a data-link-type="biblio">[HTML]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="2f0492ac">body</span> </ul> <li> <a data-link-type="biblio">[SELECTORS-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="9bfc28f6">pseudo-element</span> </ul> <li> <a data-link-type="biblio">[WEB-ANIMATIONS-1]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="e3ec4d32">discrete</span> </ul> </ul> <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2> <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3> <dl> <dt id="biblio-css-cascade-5">[CSS-CASCADE-5] <dd>Elika Etemad; Miriam Suzanne; Tab Atkins Jr.. <a href="https://drafts.csswg.org/css-cascade-5/"><cite>CSS Cascading and Inheritance Level 5</cite></a>. URL: <a href="https://drafts.csswg.org/css-cascade-5/">https://drafts.csswg.org/css-cascade-5/</a> <dt id="biblio-css-color-5">[CSS-COLOR-5] <dd>Chris Lilley; et al. <a href="https://drafts.csswg.org/css-color-5/"><cite>CSS Color Module Level 5</cite></a>. URL: <a href="https://drafts.csswg.org/css-color-5/">https://drafts.csswg.org/css-color-5/</a> <dt id="biblio-css-color-adjust-1">[CSS-COLOR-ADJUST-1] <dd>Elika Etemad; et al. <a href="https://drafts.csswg.org/css-color-adjust-1/"><cite>CSS Color Adjustment Module Level 1</cite></a>. URL: <a href="https://drafts.csswg.org/css-color-adjust-1/">https://drafts.csswg.org/css-color-adjust-1/</a> <dt id="biblio-css-overflow-3">[CSS-OVERFLOW-3] <dd>Elika Etemad; Florian Rivoal. <a href="https://drafts.csswg.org/css-overflow-3/"><cite>CSS Overflow Module Level 3</cite></a>. URL: <a href="https://drafts.csswg.org/css-overflow-3/">https://drafts.csswg.org/css-overflow-3/</a> <dt id="biblio-css-values-3">[CSS-VALUES-3] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://drafts.csswg.org/css-values-3/"><cite>CSS Values and Units Module Level 3</cite></a>. URL: <a href="https://drafts.csswg.org/css-values-3/">https://drafts.csswg.org/css-values-3/</a> <dt id="biblio-css-values-4">[CSS-VALUES-4] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://drafts.csswg.org/css-values-4/"><cite>CSS Values and Units Module Level 4</cite></a>. URL: <a href="https://drafts.csswg.org/css-values-4/">https://drafts.csswg.org/css-values-4/</a> <dt id="biblio-css2">[CSS2] <dd>Bert Bos; et al. <a href="https://drafts.csswg.org/css2/"><cite>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</cite></a>. URL: <a href="https://drafts.csswg.org/css2/">https://drafts.csswg.org/css2/</a> <dt id="biblio-rfc2119">[RFC2119] <dd>S. Bradner. <a href="https://datatracker.ietf.org/doc/html/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. March 1997. Best Current Practice. URL: <a href="https://datatracker.ietf.org/doc/html/rfc2119">https://datatracker.ietf.org/doc/html/rfc2119</a> <dt id="biblio-selectors-4">[SELECTORS-4] <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://drafts.csswg.org/selectors/"><cite>Selectors Level 4</cite></a>. URL: <a href="https://drafts.csswg.org/selectors/">https://drafts.csswg.org/selectors/</a> <dt id="biblio-web-animations-1">[WEB-ANIMATIONS-1] <dd>Brian Birtles; et al. <a href="https://drafts.csswg.org/web-animations-1/"><cite>Web Animations</cite></a>. URL: <a href="https://drafts.csswg.org/web-animations-1/">https://drafts.csswg.org/web-animations-1/</a> </dl> <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3> <dl> <dt id="biblio-html">[HTML] <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/"><cite>HTML Standard</cite></a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a> <dt id="biblio-wcag21">[WCAG21] <dd>Michael Cooper; et al. <a href="https://w3c.github.io/wcag/guidelines/"><cite>Web Content Accessibility Guidelines (WCAG) 2.1</cite></a>. URL: <a href="https://w3c.github.io/wcag/guidelines/">https://w3c.github.io/wcag/guidelines/</a> </dl> <h2 class="no-num no-ref heading settled" id="property-index"><span class="content">Property Index</span><a class="self-link" href="#property-index"></a></h2> <div class="big-element-wrapper"> <table class="index"> <thead> <tr> <th scope="col">Name <th scope="col">Value <th scope="col">Initial <th scope="col">Applies to <th scope="col">Inh. <th scope="col">%ages <th scope="col">Animation type <th scope="col">Canonical order <th scope="col">Computed value <tbody> <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-scrollbar-color" id="ref-for-propdef-scrollbar-color⑤">scrollbar-color</a> <td>auto | <color>{2} <td>auto <td>scroll containers <td>yes <td>n/a <td>by computed value <td>per grammar <td>specified keyword or two computed colors <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-scrollbar-width" id="ref-for-propdef-scrollbar-width⑧">scrollbar-width</a> <td>auto | thin | none <td>auto <td>scroll containers <td>no <td>n/a <td>discrete <td>per grammar <td>specified keyword </table> </div> <details class="mdn-anno unpositioned" data-anno-for="scrollbar-color"> <summary><b class="less-than-two-engines-flag" title="This feature is in less than two current engines.">⚠</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-color" title="The scrollbar-color CSS property sets the color of the scrollbar track and thumb.">scrollbar-color</a></p> <p class="less-than-two-engines-text">In only one current engine.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>64+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome no"><span>Chrome</span><span>None</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink no"><span>Edge</span><span>None</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="scrollbar-width"> <summary><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-width" title="The scrollbar-width property allows the author to set the maximum thickness of an element's scrollbars when they are shown.">scrollbar-width</a></p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>64+</span></span><span class="safari no"><span>Safari</span><span>None</span></span><span class="chrome yes"><span>Chrome</span><span title="Requires setting a user preference or runtime flag.">🔰 preview+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span title="Requires setting a user preference or runtime flag.">🔰 preview+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> </div> </div> </details> <script>/* Boilerplate: script-dom-helper */ "use strict"; function query(sel) { return document.querySelector(sel); } function queryAll(sel) { return [...document.querySelectorAll(sel)]; } function iter(obj) { if(!obj) return []; var it = obj[Symbol.iterator]; if(it) return it; return Object.entries(obj); } function mk(tagname, attrs, ...children) { const el = document.createElement(tagname); for(const [k,v] of iter(attrs)) { if(k.slice(0,3) == "_on") { const eventName = k.slice(3); el.addEventListener(eventName, v); } else if(k[0] == "_") { // property, not attribute el[k.slice(1)] = v; } else { if(v === false || v == null) { continue; } else if(v === true) { el.setAttribute(k, ""); continue; } else { el.setAttribute(k, v); } } } append(el, children); return el; } /* Create shortcuts for every known HTML element */ [ "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "meta", "meter", "nav", "nobr", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "s", "samp", "script", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "var", "video", "wbr", "xmp", ].forEach(tagname=>{ mk[tagname] = (...args) => mk(tagname, ...args); }); function* nodesFromChildList(children) { for(const child of children.flat(Infinity)) { if(child instanceof Node) { yield child; } else { yield new Text(child); } } } function append(el, ...children) { for(const child of nodesFromChildList(children)) { if(el instanceof Node) el.appendChild(child); else el.push(child); } return el; } function insertAfter(el, ...children) { for(const child of nodesFromChildList(children)) { el.parentNode.insertBefore(child, el.nextSibling); } return el; } function clearContents(el) { el.innerHTML = ""; return el; } function parseHTML(markup) { if(markup.toLowerCase().trim().indexOf('<!doctype') === 0) { const doc = document.implementation.createHTMLDocument(""); doc.documentElement.innerHTML = markup; return doc; } else { const el = mk.template({}); el.innerHTML = markup; return el.content; } }</script> <script>/* Boilerplate: script-dfn-panel */ "use strict"; { let dfnPanelData = { "1548047a": {"dfnID":"1548047a","dfnText":"<color>","external":true,"refSections":[{"refs":[{"id":"ref-for-typedef-color"},{"id":"ref-for-typedef-color\u2460"}],"title":"2. Scrollbar Colors: the scrollbar-color property"}],"url":"https://drafts.csswg.org/css-color-5/#typedef-color"}, "2f0492ac": {"dfnID":"2f0492ac","dfnText":"body","external":true,"refSections":[{"refs":[{"id":"ref-for-the-body-element"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"}],"url":"https://html.spec.whatwg.org/multipage/sections.html#the-body-element"}, "358fd6ff": {"dfnID":"358fd6ff","dfnText":"CSS-wide keywords","external":true,"refSections":[{"refs":[{"id":"ref-for-css-wide-keywords"}],"title":"1.2. \nValue Definitions"}],"url":"https://drafts.csswg.org/css-values-4/#css-wide-keywords"}, "6e779122": {"dfnID":"6e779122","dfnText":"user style sheet","external":true,"refSections":[{"refs":[{"id":"ref-for-cascade-origin-user"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"},{"refs":[{"id":"ref-for-cascade-origin-user\u2460"}],"title":"\nAppendix D. Considerations for accessibility"}],"url":"https://drafts.csswg.org/css-cascade-5/#cascade-origin-user"}, "6ec67710": {"dfnID":"6ec67710","dfnText":"|","external":true,"refSections":[{"refs":[{"id":"ref-for-comb-one"}],"title":"2. Scrollbar Colors: the scrollbar-color property"},{"refs":[{"id":"ref-for-comb-one\u2460"},{"id":"ref-for-comb-one\u2461"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"}],"url":"https://drafts.csswg.org/css-values-4/#comb-one"}, "7b82c9e5": {"dfnID":"7b82c9e5","dfnText":"pseudo-elements","external":true,"refSections":[{"refs":[{"id":"ref-for-x22"}],"title":"2.1. \nInteraction with non-standard features"},{"refs":[{"id":"ref-for-x22\u2460"}],"title":"3.1. \nInteraction with non-standard features"}],"url":"https://www.w3.org/TR/CSS2/selector.html#x22"}, "86923d07": {"dfnID":"86923d07","dfnText":"scroll container","external":true,"refSections":[{"refs":[{"id":"ref-for-scroll-container"}],"title":"2. Scrollbar Colors: the scrollbar-color property"},{"refs":[{"id":"ref-for-scroll-container\u2460"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"}],"url":"https://drafts.csswg.org/css-overflow-3/#scroll-container"}, "86928bde": {"dfnID":"86928bde","dfnText":"overflow","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-overflow"}],"title":"2. Scrollbar Colors: the scrollbar-color property"},{"refs":[{"id":"ref-for-propdef-overflow\u2460"},{"id":"ref-for-propdef-overflow\u2461"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"}],"url":"https://drafts.csswg.org/css-overflow-3/#propdef-overflow"}, "884d81d3": {"dfnID":"884d81d3","dfnText":"overlay scrollbars","external":true,"refSections":[{"refs":[{"id":"ref-for-overlay-scrollbars"},{"id":"ref-for-overlay-scrollbars\u2460"}],"title":"2. Scrollbar Colors: the scrollbar-color property"},{"refs":[{"id":"ref-for-overlay-scrollbars\u2461"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"}],"url":"https://drafts.csswg.org/css-overflow-3/#overlay-scrollbars"}, "9bfc28f6": {"dfnID":"9bfc28f6","dfnText":"pseudo-element","external":true,"refSections":[{"refs":[{"id":"ref-for-pseudo-element"}],"title":"2.1. \nInteraction with non-standard features"},{"refs":[{"id":"ref-for-pseudo-element\u2460"}],"title":"3.1. \nInteraction with non-standard features"}],"url":"https://drafts.csswg.org/selectors-4/#pseudo-element"}, "9cd25054": {"dfnID":"9cd25054","dfnText":"computed value","external":true,"refSections":[{"refs":[{"id":"ref-for-computed-value"}],"title":"2.1. \nInteraction with non-standard features"},{"refs":[{"id":"ref-for-computed-value\u2460"}],"title":"3.1. \nInteraction with non-standard features"}],"url":"https://drafts.csswg.org/css-cascade-5/#computed-value"}, "b0d8ebd9": {"dfnID":"b0d8ebd9","dfnText":"{A}","external":true,"refSections":[{"refs":[{"id":"ref-for-mult-num"}],"title":"2. Scrollbar Colors: the scrollbar-color property"}],"url":"https://drafts.csswg.org/css-values-4/#mult-num"}, "buttons": {"dfnID":"buttons","dfnText":"buttons","external":false,"refSections":[{"refs":[{"id":"ref-for-buttons"}],"title":"2. Scrollbar Colors: the scrollbar-color property"}],"url":"#buttons"}, "c373c5f8": {"dfnID":"c373c5f8","dfnText":"color-scheme","external":true,"refSections":[{"refs":[{"id":"ref-for-propdef-color-scheme"}],"title":"2. Scrollbar Colors: the scrollbar-color property"},{"refs":[{"id":"ref-for-propdef-color-scheme\u2460"}],"title":"\nChanges from the 2018-09-25 First Public Working Draft"}],"url":"https://drafts.csswg.org/css-color-adjust-1/#propdef-color-scheme"}, "e3ec4d32": {"dfnID":"e3ec4d32","dfnText":"discrete","external":true,"refSections":[{"refs":[{"id":"ref-for-discrete"}],"title":"\nChanges since the 9 December 2021 Candidate Recommendation"}],"url":"https://drafts.csswg.org/web-animations-1/#discrete"}, "propdef-scrollbar-color": {"dfnID":"propdef-scrollbar-color","dfnText":"scrollbar-color","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-scrollbar-color"}],"title":"1. \nIntroduction"},{"refs":[{"id":"ref-for-propdef-scrollbar-color\u2460"},{"id":"ref-for-propdef-scrollbar-color\u2461"}],"title":"2. Scrollbar Colors: the scrollbar-color property"},{"refs":[{"id":"ref-for-propdef-scrollbar-color\u2462"}],"title":"2.1. \nInteraction with non-standard features"},{"refs":[{"id":"ref-for-propdef-scrollbar-color\u2463"}],"title":"\nChanges from the 2018-09-25 First Public Working Draft"}],"url":"#propdef-scrollbar-color"}, "propdef-scrollbar-width": {"dfnID":"propdef-scrollbar-width","dfnText":"scrollbar-width","external":false,"refSections":[{"refs":[{"id":"ref-for-propdef-scrollbar-width"}],"title":"1. \nIntroduction"},{"refs":[{"id":"ref-for-propdef-scrollbar-width\u2460"},{"id":"ref-for-propdef-scrollbar-width\u2461"},{"id":"ref-for-propdef-scrollbar-width\u2462"},{"id":"ref-for-propdef-scrollbar-width\u2463"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"},{"refs":[{"id":"ref-for-propdef-scrollbar-width\u2464"}],"title":"3.1. \nInteraction with non-standard features"},{"refs":[{"id":"ref-for-propdef-scrollbar-width\u2465"}],"title":"\nChanges since the 9 December 2021 Candidate Recommendation"},{"refs":[{"id":"ref-for-propdef-scrollbar-width\u2466"}],"title":"\nAppendix D. Considerations for accessibility"}],"url":"#propdef-scrollbar-width"}, "thumb": {"dfnID":"thumb","dfnText":"thumb","external":false,"refSections":[{"refs":[{"id":"ref-for-thumb"},{"id":"ref-for-thumb\u2460"},{"id":"ref-for-thumb\u2461"},{"id":"ref-for-thumb\u2462"},{"id":"ref-for-thumb\u2463"},{"id":"ref-for-thumb\u2464"},{"id":"ref-for-thumb\u2465"},{"id":"ref-for-thumb\u2466"},{"id":"ref-for-thumb\u2467"},{"id":"ref-for-thumb\u2468"}],"title":"2. Scrollbar Colors: the scrollbar-color property"}],"url":"#thumb"}, "track": {"dfnID":"track","dfnText":"track","external":false,"refSections":[{"refs":[{"id":"ref-for-track"},{"id":"ref-for-track\u2460"},{"id":"ref-for-track\u2461"},{"id":"ref-for-track\u2462"},{"id":"ref-for-track\u2463"},{"id":"ref-for-track\u2464"},{"id":"ref-for-track\u2465"},{"id":"ref-for-track\u2466"},{"id":"ref-for-track\u2467"},{"id":"ref-for-track\u2468"},{"id":"ref-for-track\u2460\u24ea"}],"title":"2. Scrollbar Colors: the scrollbar-color property"}],"url":"#track"}, "valdef-scrollbar-color-auto": {"dfnID":"valdef-scrollbar-color-auto","dfnText":"auto","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-scrollbar-color-auto"},{"id":"ref-for-valdef-scrollbar-color-auto\u2460"}],"title":"2. Scrollbar Colors: the scrollbar-color property"},{"refs":[{"id":"ref-for-valdef-scrollbar-color-auto\u2461"}],"title":"2.1. \nInteraction with non-standard features"},{"refs":[{"id":"ref-for-valdef-scrollbar-color-auto\u2462"}],"title":"\nChanges from the 2018-09-25 First Public Working Draft"}],"url":"#valdef-scrollbar-color-auto"}, "valdef-scrollbar-color-color": {"dfnID":"valdef-scrollbar-color-color","dfnText":"<color>","external":false,"refSections":[],"url":"#valdef-scrollbar-color-color"}, "valdef-scrollbar-width-auto": {"dfnID":"valdef-scrollbar-width-auto","dfnText":"auto","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-scrollbar-width-auto"},{"id":"ref-for-valdef-scrollbar-width-auto\u2460"},{"id":"ref-for-valdef-scrollbar-width-auto\u2461"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"},{"refs":[{"id":"ref-for-valdef-scrollbar-width-auto\u2462"}],"title":"3.1. \nInteraction with non-standard features"}],"url":"#valdef-scrollbar-width-auto"}, "valdef-scrollbar-width-none": {"dfnID":"valdef-scrollbar-width-none","dfnText":"none","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-scrollbar-width-none"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"}],"url":"#valdef-scrollbar-width-none"}, "valdef-scrollbar-width-thin": {"dfnID":"valdef-scrollbar-width-thin","dfnText":"thin","external":false,"refSections":[{"refs":[{"id":"ref-for-valdef-scrollbar-width-thin"}],"title":"3. Scrollbar Thickness: the scrollbar-width property"}],"url":"#valdef-scrollbar-width-thin"}, }; document.addEventListener("DOMContentLoaded", ()=>{ genAllDfnPanels(); document.body.addEventListener("click", (e) => { // If not handled already, just hide all dfn panels. hideAllDfnPanels(); }); }); window.addEventListener("resize", () => { // Pin any visible dfn panel queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(el=>positionDfnPanel(el)); }); function genAllDfnPanels() { for(const panelData of Object.values(dfnPanelData)) { const dfnID = panelData.dfnID; const dfn = document.getElementById(dfnID); if(!dfn) { console.log(`Can't find dfn#${dfnID}.`, panelData); continue; } dfn.panelData = panelData; insertDfnPopupAction(dfn); } } function genDfnPanel(dfn, { dfnID, url, dfnText, refSections, external }) { const dfnPanel = mk.aside({ class: "dfn-panel on", id: `infopanel-for-${dfnID}`, "data-for": dfnID, "aria-labelled-by":`infopaneltitle-for-${dfnID}`, }, mk.span({id:`infopaneltitle-for-${dfnID}`, style:"display:none"}, `Info about the '${dfnText}' ${external?"external":""} reference.`), mk.a({href:url, class:"dfn-link"}, url), refSections.length == 0 ? [] : mk.b({}, "Referenced in:"), mk.ul({}, ...refSections.map(section=> mk.li({}, ...section.refs.map((ref, refI)=> [ mk.a({ href: `#${ref.id}` }, (refI == 0) ? section.title : `(${refI + 1})` ), " ", ] ), ), ), ), genLinkingSyntaxes(dfn), ); dfnPanel.addEventListener('click', (event) => { if (event.target.nodeName == 'A') { scrollToTargetAndHighlight(event); pinDfnPanel(dfnPanel); } event.stopPropagation(); refocusOnTarget(event); }); dfnPanel.addEventListener('keydown', (event) => { if(event.keyCode == 27) { // Escape key hideDfnPanel({dfnPanel}); event.stopPropagation(); event.preventDefault(); } }); dfnPanel.dfn = dfn; dfn.dfnPanel = dfnPanel; return dfnPanel; } function hideAllDfnPanels() { // Delete the currently-active dfn panel. queryAll(".dfn-panel").forEach(dfnPanel=>hideDfnPanel({dfnPanel})); } function showDfnPanel(dfn) { hideAllDfnPanels(); // Only display one at a time. dfn.setAttribute("aria-expanded", "true"); const dfnPanel = genDfnPanel(dfn, dfn.panelData); // Give the dfn a unique tabindex, and then // give all the tabbable panel bits successive indexes. let tabIndex = 100; dfn.tabIndex = tabIndex++; const tabbable = dfnPanel.querySelectorAll(":is(a, button)"); for (const el of tabbable) { el.tabIndex = tabIndex++; } append(document.body, dfnPanel); positionDfnPanel(dfnPanel); } function positionDfnPanel(dfnPanel) { const dfn = dfnPanel.dfn; const dfnPos = getBounds(dfn); dfnPanel.style.top = dfnPos.bottom + "px"; dfnPanel.style.left = dfnPos.left + "px"; const panelPos = dfnPanel.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, dfnPos.left - overflowAmount); dfnPanel.style.left = newLeft + "px"; } } function pinDfnPanel(dfnPanel) { // Switch it to "activated" state, which pins it. dfnPanel.classList.add("activated"); dfnPanel.style.position = "fixed"; dfnPanel.style.left = null; dfnPanel.style.top = null; } function hideDfnPanel({dfn, dfnPanel}) { if(!dfnPanel) dfnPanel = dfn.dfnPanel; if(!dfn) dfn = dfnPanel.dfn; dfn.dfnPanel = undefined; dfnPanel.dfn = undefined; dfn.setAttribute("aria-expanded", "false"); dfn.tabIndex = undefined; dfnPanel.remove() } function toggleDfnPanel(dfn) { if(dfn.dfnPanel) { hideDfnPanel(dfn); } else { showDfnPanel(dfn); } } function insertDfnPopupAction(dfn) { dfn.setAttribute('role', 'button'); dfn.setAttribute('aria-expanded', 'false') dfn.tabIndex = 0; dfn.classList.add('has-dfn-panel'); dfn.addEventListener('click', (event) => { toggleDfnPanel(dfn); event.stopPropagation(); }); dfn.addEventListener('keypress', (event) => { const kc = event.keyCode; // 32->Space, 13->Enter if(kc == 32 || kc == 13) { toggleDfnPanel(dfn); event.stopPropagation(); event.preventDefault(); } }); } function refocusOnTarget(event) { const target = event.target; setTimeout(() => { // Refocus on the event.target element. // This is needed after browser scrolls to the destination. target.focus(); }); } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function scrollToTargetAndHighlight(event) { let hash = event.target.hash; if (hash) { hash = decodeURIComponent(hash.substring(1)); const dest = document.getElementById(hash); if (dest) { dest.classList.add('highlighted'); setTimeout(() => dest.classList.remove('highlighted'), 1000); } } } // Functions, divided by link type, that wrap an autolink's // contents with the appropriate outer syntax. // Alternately, a string naming another type they format // the same as. function needsFor(type) { switch(type) { case "descriptor": case "value": case "element-attr": case "attr-value": case "element-state": case "method": case "constructor": case "argument": case "attribute": case "const": case "dict-member": case "event": case "enum-value": case "stringifier": case "serializer": case "iterator": case "maplike": case "setlike": case "state": case "mode": case "context": case "facet": return true; default: return false; } } function refusesFor(type) { switch(type) { case "property": case "element": case "interface": case "namespace": case "callback": case "dictionary": case "enum": case "exception": case "typedef": case "http-header": case "permission": return true; default: return false; } } function linkFormatterFromType(type) { switch(type) { case 'scheme': case 'permission': case 'dfn': return (text) => `[=${text}=]`; case 'abstract-op': return (text) => `[\$${text}\$]`; case 'function': case 'at-rule': case 'selector': case 'value': return (text) => `''${text}''`; case 'http-header': return (text) => `[:${text}:]`; case 'interface': case 'constructor': case 'method': case 'argument': case 'attribute': case 'callback': case 'dictionary': case 'dict-member': case 'enum': case 'enum-value': case 'exception': case 'const': case 'typedef': case 'stringifier': case 'serializer': case 'iterator': case 'maplike': case 'setlike': case 'extended-attribute': case 'event': case 'idl': return (text) => `{{${text}}}`; case 'element-state': case 'element-attr': case 'attr-value': case 'element': return (element) => `<{${element}}>`; case 'grammar': return (text) => `${text} (within a <pre class=prod>)`; case 'type': return (text)=> `<<${text}>>`; case 'descriptor': case 'property': return (text) => `'${text}'`; default: return; }; }; function genLinkingSyntaxes(dfn) { if(dfn.tagName != "DFN") return; const type = dfn.getAttribute('data-dfn-type'); if(!type) { console.log(`<dfn> doesn't have a data-dfn-type:`, dfn); return []; } // Return a function that wraps link text based on the type const linkFormatter = linkFormatterFromType(type); if(!linkFormatter) { console.log(`<dfn> has an unknown data-dfn-type:`, dfn); return []; } let ltAlts; if(dfn.hasAttribute('data-lt')) { ltAlts = dfn.getAttribute('data-lt') .split("|") .map(x=>x.trim()); } else { ltAlts = [dfn.textContent.trim()]; } if(type == "type") { // lt of "<foo>", but "foo" is the interior; // <<foo/bar>> is how you write it with a for, // not <foo/<bar>> or whatever. for(var i = 0; i < ltAlts.length; i++) { const lt = ltAlts[i]; const match = /<(.*)>/.exec(lt); if(match) { ltAlts[i] = match[1]; } } } let forAlts; if(dfn.hasAttribute('data-dfn-for')) { forAlts = dfn.getAttribute('data-dfn-for') .split(",") .map(x=>x.trim()); } else { forAlts = ['']; } let linkingSyntaxes = []; if(!needsFor(type)) { for(const lt of ltAlts) { linkingSyntaxes.push(linkFormatter(lt)); } } if(!refusesFor(type)) { for(const f of forAlts) { linkingSyntaxes.push(linkFormatter(`${f}/${ltAlts[0]}`)) } } return [ mk.b({}, 'Possible linking syntaxes:'), mk.ul({}, ...linkingSyntaxes.map(link => { const copyLink = async () => await navigator.clipboard.writeText(link); return mk.li({}, mk.div({ class: 'link-item' }, mk.button({ class: 'copy-icon', title: 'Copy', type: 'button', _onclick: copyLink, tabindex: 0, }, mk.span({ class: 'icon' }) ), mk.span({}, link) ) ); }) ) ]; } } </script> <script>/* Boilerplate: script-link-titles */ "use strict"; { let linkTitleData = { "https://drafts.csswg.org/css-color-5/#typedef-color": "Expands to: <alpha-value> | aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | currentcolor | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | none | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | transparent | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen", }; function setTypeTitles() { for(let el of document.querySelectorAll("a[href]")) { if(el.href in linkTitleData && !el.hasAttribute("title")) { el.setAttribute("title", linkTitleData[el.href]); } } } document.addEventListener("DOMContentLoaded", setTypeTitles); } </script> <script>/* Boilerplate: script-position-annos */ "use strict"; { function repositionAnnoPanels(){ const panels = [...document.querySelectorAll("[data-anno-for]")]; hydratePanels(panels); let vSoFar = 0; for(const panel of panels.sort(cmpTops)) { if(panel.top < vSoFar) { panel.top = vSoFar; panel.style.top = vSoFar + "px"; } vSoFar = panel.top + panel.height + 15; } } function hydratePanels(panels) { const main = document.querySelector("main"); let mainRect; if(main) mainRect = main.getBoundingClientRect(); // First display them all, if they're not already visible. for(const panel of panels) { panel.classList.remove("unpositioned"); } // Measure them all for(const panel of panels) { const dfn = document.getElementById(panel.getAttribute("data-anno-for")); if(!dfn) { console.log("Can't find the annotation panel target:", panel); continue; } panel.dfn = dfn; panel.top = window.scrollY + dfn.getBoundingClientRect().top; let panelRect = panel.getBoundingClientRect(); panel.height = panelRect.height; if(main) { panel.overlappingMain = panelRect.left < mainRect.right; } else { panel.overlappingMain = false; } } // And finally position them for(const panel of panels) { const dfn = panel.dfn; if(!dfn) continue; panel.style.top = panel.top + "px"; panel.classList.toggle("overlapping-main", panel.overlappingMain); } } function cmpTops(a,b) { return a.top - b.top; } window.addEventListener("load", repositionAnnoPanels); window.addEventListener("resize", repositionAnnoPanels); } </script> <script>/* Boilerplate: script-ref-hints */ "use strict"; { let refsData = { "#buttons": {"displayText":"buttons","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scrollbars","spec":"css-scrollbars-1","status":"local","text":"buttons","type":"dfn","url":"#buttons"}, "#propdef-scrollbar-color": {"displayText":"scrollbar-color","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scrollbars","spec":"css-scrollbars-1","status":"local","text":"scrollbar-color","type":"property","url":"#propdef-scrollbar-color"}, "#propdef-scrollbar-width": {"displayText":"scrollbar-width","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scrollbars","spec":"css-scrollbars-1","status":"local","text":"scrollbar-width","type":"property","url":"#propdef-scrollbar-width"}, "#thumb": {"displayText":"thumb","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scrollbars","spec":"css-scrollbars-1","status":"local","text":"thumb","type":"dfn","url":"#thumb"}, "#track": {"displayText":"track","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-scrollbars","spec":"css-scrollbars-1","status":"local","text":"track","type":"dfn","url":"#track"}, "#valdef-scrollbar-color-auto": {"displayText":"auto","export":true,"for_":["scrollbar-color"],"level":"1","normative":true,"shortname":"css-scrollbars","spec":"css-scrollbars-1","status":"local","text":"auto","type":"value","url":"#valdef-scrollbar-color-auto"}, "#valdef-scrollbar-width-auto": {"displayText":"auto","export":true,"for_":["scrollbar-width"],"level":"1","normative":true,"shortname":"css-scrollbars","spec":"css-scrollbars-1","status":"local","text":"auto","type":"value","url":"#valdef-scrollbar-width-auto"}, "#valdef-scrollbar-width-none": {"displayText":"none","export":true,"for_":["scrollbar-width"],"level":"1","normative":true,"shortname":"css-scrollbars","spec":"css-scrollbars-1","status":"local","text":"none","type":"value","url":"#valdef-scrollbar-width-none"}, "#valdef-scrollbar-width-thin": {"displayText":"thin","export":true,"for_":["scrollbar-width"],"level":"1","normative":true,"shortname":"css-scrollbars","spec":"css-scrollbars-1","status":"local","text":"thin","type":"value","url":"#valdef-scrollbar-width-thin"}, "https://drafts.csswg.org/css-cascade-5/#cascade-origin-user": {"displayText":"user style sheet","export":true,"for_":[],"level":"5","normative":true,"shortname":"css-cascade","spec":"css-cascade-5","status":"current","text":"user style sheet","type":"dfn","url":"https://drafts.csswg.org/css-cascade-5/#cascade-origin-user"}, "https://drafts.csswg.org/css-cascade-5/#computed-value": {"displayText":"computed value","export":true,"for_":[],"level":"5","normative":true,"shortname":"css-cascade","spec":"css-cascade-5","status":"current","text":"computed value","type":"dfn","url":"https://drafts.csswg.org/css-cascade-5/#computed-value"}, "https://drafts.csswg.org/css-color-5/#typedef-color": {"displayText":"<color>","export":true,"for_":[],"level":"5","normative":true,"shortname":"css-color","spec":"css-color-5","status":"current","text":"<color>","type":"type","url":"https://drafts.csswg.org/css-color-5/#typedef-color"}, "https://drafts.csswg.org/css-color-adjust-1/#propdef-color-scheme": {"displayText":"color-scheme","export":true,"for_":[],"level":"1","normative":true,"shortname":"css-color-adjust","spec":"css-color-adjust-1","status":"current","text":"color-scheme","type":"property","url":"https://drafts.csswg.org/css-color-adjust-1/#propdef-color-scheme"}, "https://drafts.csswg.org/css-overflow-3/#overlay-scrollbars": {"displayText":"overlay scrollbars","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-overflow","spec":"css-overflow-3","status":"current","text":"overlay scrollbars","type":"dfn","url":"https://drafts.csswg.org/css-overflow-3/#overlay-scrollbars"}, "https://drafts.csswg.org/css-overflow-3/#propdef-overflow": {"displayText":"overflow","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-overflow","spec":"css-overflow-3","status":"current","text":"overflow","type":"property","url":"https://drafts.csswg.org/css-overflow-3/#propdef-overflow"}, "https://drafts.csswg.org/css-overflow-3/#scroll-container": {"displayText":"scroll container","export":true,"for_":[],"level":"3","normative":true,"shortname":"css-overflow","spec":"css-overflow-3","status":"current","text":"scroll container","type":"dfn","url":"https://drafts.csswg.org/css-overflow-3/#scroll-container"}, "https://drafts.csswg.org/css-values-4/#comb-one": {"displayText":"|","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"|","type":"grammar","url":"https://drafts.csswg.org/css-values-4/#comb-one"}, "https://drafts.csswg.org/css-values-4/#css-wide-keywords": {"displayText":"CSS-wide keywords","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"css-wide keywords","type":"dfn","url":"https://drafts.csswg.org/css-values-4/#css-wide-keywords"}, "https://drafts.csswg.org/css-values-4/#mult-num": {"displayText":"{A}","export":true,"for_":[],"level":"4","normative":true,"shortname":"css-values","spec":"css-values-4","status":"current","text":"{a}","type":"grammar","url":"https://drafts.csswg.org/css-values-4/#mult-num"}, "https://drafts.csswg.org/selectors-4/#pseudo-element": {"displayText":"pseudo-element","export":true,"for_":[],"level":"4","normative":true,"shortname":"selectors","spec":"selectors-4","status":"current","text":"pseudo-element","type":"dfn","url":"https://drafts.csswg.org/selectors-4/#pseudo-element"}, "https://drafts.csswg.org/web-animations-1/#discrete": {"displayText":"discrete","export":true,"for_":[],"level":"1","normative":true,"shortname":"web-animations","spec":"web-animations-1","status":"current","text":"discrete","type":"dfn","url":"https://drafts.csswg.org/web-animations-1/#discrete"}, "https://html.spec.whatwg.org/multipage/sections.html#the-body-element": {"displayText":"body","export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"body","type":"element","url":"https://html.spec.whatwg.org/multipage/sections.html#the-body-element"}, "https://www.w3.org/TR/CSS2/selector.html#x22": {"displayText":"pseudo-elements","export":true,"for_":[],"level":"2","normative":true,"shortname":"css","spec":"css2","status":"snapshot","text":"pseudo-elements","type":"dfn","url":"https://www.w3.org/TR/CSS2/selector.html#x22"}, }; function mkRefHint(link, ref) { const linkText = link.textContent; let dfnTextElements = ''; if (ref.displayText.toLowerCase() != linkText.toLowerCase()) { // Give the original term if it's being displayed in a different way. // But allow casing differences, they're insignificant. dfnTextElements = mk.li({}, mk.b({}, "Term: "), mk.span({}, ref.displayText) ); } const forList = ref.for_; let forListElements; if(forList.length == 0) { forListElements = []; } else if(forList.length == 1) { forListElements = mk.li({}, mk.b({}, "For: "), mk.span({}, forList[0]), ); } else { forListElements = mk.li({}, mk.b({}, "For: "), mk.ul({}, ...forList.map(forItem => mk.li({}, mk.span({}, forItem) ), ), ), ); } const url = ref.url; const safeUrl = encodeURIComponent(url); const hintPanel = mk.aside({ class: "ref-hint", id: `ref-hint-for-${safeUrl}`, "data-for": url, "aria-labelled-by": `ref-hint-for-${safeUrl}`, }, mk.ul({}, dfnTextElements, mk.li({}, mk.b({}, "URL: "), mk.a({ href: url, class: "ref" }, url), ), mk.li({}, mk.b({}, "Type: "), mk.span({}, `${ref.type}`), ), mk.li({}, mk.b({}, "Spec: "), mk.span({}, `${ref.spec ? ref.spec : ''}`), ), forListElements ), ); hintPanel.forLink = link; setupRefHintEventListeners(link, hintPanel); return hintPanel; } function hideAllRefHints() { queryAll(".ref-hint").forEach(el=>hideRefHint(el)); } function hideRefHint(refHint) { const link = refHint.forLink; link.setAttribute("aria-expanded", "false"); if(refHint.teardownEventListeners) { refHint.teardownEventListeners(); } refHint.remove(); } function showRefHint(link) { if(link.classList.contains("dfn-link")) return; const url = link.getAttribute("href"); const refHintKey = link.getAttribute("data-refhint-key"); let key = url; if(refHintKey) { key = refHintKey + "_" + url; } const ref = refsData[key]; if(!ref) return; hideAllRefHints(); // Only display one at this time. const refHint = mkRefHint(link, ref); append(document.body, refHint); link.setAttribute("aria-expanded", "true"); positionRefHint(refHint); } function setupRefHintEventListeners(link, refHint) { if (refHint.teardownEventListeners) return; // Add event handlers to hide the refHint after the user moves away // from both the link and refHint, if not hovering either within one second. let timeout = null; const startHidingRefHint = (event) => { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(() => { hideRefHint(refHint); }, 1000); } const resetHidingRefHint = (event) => { if (timeout) clearTimeout(timeout); timeout = null; }; link.addEventListener("mouseleave", startHidingRefHint); link.addEventListener("mouseenter", resetHidingRefHint); link.addEventListener("blur", startHidingRefHint); link.addEventListener("focus", resetHidingRefHint); refHint.addEventListener("mouseleave", startHidingRefHint); refHint.addEventListener("mouseenter", resetHidingRefHint); refHint.addEventListener("blur", startHidingRefHint); refHint.addEventListener("focus", resetHidingRefHint); refHint.teardownEventListeners = () => { // remove event listeners resetHidingRefHint(); link.removeEventListener("mouseleave", startHidingRefHint); link.removeEventListener("mouseenter", resetHidingRefHint); link.removeEventListener("blur", startHidingRefHint); link.removeEventListener("focus", resetHidingRefHint); refHint.removeEventListener("mouseleave", startHidingRefHint); refHint.removeEventListener("mouseenter", resetHidingRefHint); refHint.removeEventListener("blur", startHidingRefHint); refHint.removeEventListener("focus", resetHidingRefHint); }; } function positionRefHint(refHint) { const link = refHint.forLink; const linkPos = getBounds(link); refHint.style.top = linkPos.bottom + "px"; refHint.style.left = linkPos.left + "px"; const panelPos = refHint.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, linkPos.left - overflowAmount); refHint.style.left = newLeft + "px"; } } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function showRefHintListener(e) { // If the target isn't in a link (or is a link), // just ignore it. let link = e.target.closest("a"); if(!link) return; // If the target is in a ref-hint panel // (aka a link in the already-open one), // also just ignore it. if(link.closest(".ref-hint")) return; // Otherwise, show the panel for the link. showRefHint(link); } function hideAllHintsListener(e) { // If the click is inside a ref-hint panel, ignore it. if(e.target.closest(".ref-hint")) return; // Otherwise, close all the current panels. hideAllRefHints(); } document.addEventListener("DOMContentLoaded", () => { document.body.addEventListener("mousedown", showRefHintListener); document.body.addEventListener("focus", showRefHintListener); document.body.addEventListener("click", hideAllHintsListener); }); window.addEventListener("resize", () => { // Hide any open ref hint. hideAllRefHints(); }); } </script> <script>/* Boilerplate: script-wpt */ "use strict"; { let wptData = { "paths": ["/css/css-scrollbars/","/web-animations/animation-model/"], }; document.addEventListener("DOMContentLoaded", async ()=>{ if(wptData.paths.length == 0) return; const runsUrl = "https://wpt.fyi/api/runs?label=master&label=stable&max-count=1&product=chrome&product=firefox&product=safari&product=edge"; const runs = await (await fetch(runsUrl)).json(); let testResults = []; for(const pathPrefix of wptData.paths) { const pathResults = await (await fetch("https://wpt.fyi/api/search", { method:"POST", headers:{ "Content-Type":"application/json", }, body: JSON.stringify({ "run_ids": runs.map(x=>x.id), "query": {"path": pathPrefix}, }) })).json(); testResults = testResults.concat(pathResults.results); } const browsers = runs.map(x=>({name:x.browser_name, version:x.browser_version, passes:0, total: 0})); const resultsFromPath = new Map(testResults.map(result=>{ const testPath = result.test; const passes = result.legacy_status.map(x=>[x.passes, x.total]); return [testPath, passes]; })); const seenTests = new Set(); document.querySelectorAll(".wpt-name").forEach(nameEl=>{ const passData = resultsFromPath.get("/" + nameEl.getAttribute("title")); if(!passData) { console.log("Couldn't find test in results:", nameEl); return } const numTests = passData[0][1]; if(numTests > 1) { nameEl.insertAdjacentElement("beforeend", mk.small({}, ` (${numTests} tests)`)); } if(passData == undefined) return; const resultsEl = mk.span({"class":"wpt-results"}, ...passData.map((p,i) => mk.span( { "title": `${browsers[i].name} ${p[0]}/${p[1]}`, "class": "wpt-result", "style": `background: conic-gradient(forestgreen ${p[0]/p[1]*360}deg, darkred 0deg);`, })), ); nameEl.insertAdjacentElement("afterend", resultsEl); // Only update the summary pass/total count if we haven't seen this // test before, to support authors listing the same test multiple times // in a spec. if (!seenTests.has(nameEl.getAttribute("title"))) { seenTests.add(nameEl.getAttribute("title")); passData.forEach((p,i) => { browsers[i].passes += p[0]; browsers[i].total += p[1]; }); } }); const overview = document.querySelector(".wpt-overview"); if(overview) { overview.appendChild(mk.ul({}, ...browsers.map(formatWptResult))); document.head.appendChild(mk.style({}, `.wpt-overview ul { display: flex; flex-flow: row wrap; gap: .2em; justify-content: start; list-style: none; padding: 0; margin: 0;} .wpt-overview li { padding: .25em 1em; color: black; text-align: center; } .wpt-overview img { height: 1.5em; height: max(1.5em, 32px); background: transparent; } .wpt-overview .browser { font-weight: bold; } .wpt-overview .passes-none { background: #e57373; } .wpt-overview .passes-hardly { background: #ffb74d; } .wpt-overview .passes-a-few { background: #ffd54f; } .wpt-overview .passes-half { background: #fff176; } .wpt-overview .passes-lots { background: #dce775; } .wpt-overview .passes-most { background: #aed581; } .wpt-overview .passes-all { background: #81c784; }`)); } }); function formatWptResult({name, version, passes, total}) { const passRate = passes/total; let passClass = ""; if(passRate == 0) passClass = "passes-none"; else if(passRate < .2) passClass = "passes-hardly"; else if(passRate < .4) passClass = "passes-a-few"; else if(passRate < .6) passClass = "passes-half"; else if(passRate < .8) passClass = "passes-lots"; else if(passRate < 1) passClass = "passes-most"; else passClass = "passes-all"; name = name[0].toUpperCase() + name.slice(1); const shortVersion = /^\d+/.exec(version); const icon = [] if(name == "Chrome") icon.push(mk.img({alt:"", src:"https://wpt.fyi/static/chrome_64x64.png"})); if(name == "Edge") icon.push(mk.img({alt:"", src:"https://wpt.fyi/static/edge_64x64.png"})); if(name == "Safari") icon.push(mk.img({alt:"", src:"https://wpt.fyi/static/safari_64x64.png"})); if(name == "Firefox") icon.push(mk.img({alt:"", src:"https://wpt.fyi/static/firefox_64x64.png"})); return mk.li({"class":passClass}, mk.nobr({'class':'browser'}, ...icon, ` ${name} ${shortVersion}`), mk.br(), mk.nobr({'class':'pass-rate'}, `${passes}/${total}`) ); } } </script>