Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
301 lines (237 sloc) 10.9 KB
<pre class='metadata'>
Title: CSS Scrollbars Module Level 1
Group: csswg
Shortname: css-scrollbars
Level: 1
Status: ED
Work Status: Revising
Repository: css-scrollbars
Editor: Tantek Çelik, Mozilla,, w3cid 1464
Editor: Rossen Atanassov, Microsoft,, w3cid 49885
Abstract: CSS Scrollbars standardizes the ability to color scrollbars introduced in 2000 by Windows IE 5.5.
This is useful when building web applications which use color schemes very different from
the appearance of default platform scrollbars.
Link Defaults: css-color-3 (property) color
<h2 id="intro">
Note: this specification is
<a href="">
maintained in the W3C csswg-drafts GitHub repository as css-scrollbars-1
<h3 id="scope">
<em>This subsection is non-normative.</em>
Based on
<a href="">documented use-cases</a>,
there are three main use-cases around scrollbars this module intends to resolve:
<li>Color scrollbars to fit better into the UI of a web application.
<li>Use thinner scrollbar when the scrolling area is small.
<li>Build customized scrollbars without affecting scrollability.
For addressing these use-cases, this module adds properties to control colors and
width of scrollbars (if any) of an element.
Pseudo-elements for selecting specific parts of a scrollbar is out of scope.
The WebKit implementation of pseudo-elements for scrollbar is
considered to be a feature mistakenly exposed to the web.
Main concerns against the pseudo-elements approach are:
<li>Operating systems continuously evolve their scrollbar designs to provide better user experience,
beyond the ability of any set of pseudo-elements to accurately model this over time.
<li>Different platforms have different scrollbar structure means testing interop is harder,
because authors would need to take not only engine but also platforms into account.
<h3 id="values">
This specification follows the
<a href="">CSS property definition conventions</a> from [[!CSS2]].
Value types not defined in this specification are defined in CSS Values & Units [[!CSS-VALUES-3]].
Other CSS modules may expand the definitions of these value types.
In addition to the property-specific values listed in their definitions,
all properties defined in this specification
also accept the <a>CSS-wide keywords</a> keywords as their property value.
For readability they have not been repeated explicitly.
<h2 id="scrollbar-color">Scrollbar Colors: the 'scrollbar-color' property</h2>
<pre class="propdef">
Name: scrollbar-color
Value: auto | dark | light | <<color>>{2}
Initial: auto
Inherited: yes
Computed value: specified keyword or two computed colors
Animation type: by computed value
Applies to: boxes to which 'overflow' applies
Percentages: n/a
This property allows the author to set colors of an element's scrollbars.
UAs must apply the scrollbar-color value set on the root element to the viewport.
Note: Unlike 'overflow' (and overflow-*) properties,
scrollbar-color value set on the HTML body element are not propagated to the viewport.
<dl dfn-type="value" dfn-for="scrollbar-color">
<dd>default platform rendering for the scrollbar.</dd>
show a dark scrollbar,
which can be either a dark variant of scrollbar provided by the platform,
or a custom scrollbar with dark colors.
show a light scrollbar,
which can be either a light variant of scrollbar provided by the platform,
or a custom scrollbar with light colors.
apply the first color to the thumb of the scrollbar,
and the second color to the track of the scrollbar.
Track refers to the background of the scrollbar,
which is generally fixed regardless of the scrolling position.
Thumb refers to the moving part of the scrollbar,
which usually floats on top of the track.
If this property computes to value other than ''auto'',
implementations may render a simpler scrollbar than the default platform UI rendering,
and color it accordingly.
(Note: add diagram showing the different named pieces - something like
<a href=""></a>)
(Note: add example of an overflow element with colorized scrollbars to match page styling,
PNG of the same in a browser that supports it currently)
Implementations may ignore any of the colors
if the corresponding part do not exist on the underlying platform.
When using scrollbar-color property with specific color values,
authors should ensure the specified colors have enough contrast between them.
For keyword values, UAs should ensure the colors they use have enough contrast.
See <a href="">
Techniques for WCAG 2.0: G183: Using a contrast ratio of 3:1 […]</a> [[WCAG20]].
Note: when a user interacts with a scrollbar (e.g. hovering or activating),
implementations may alter which scrollbar colors apply to which scrollbar parts.
Note: IE uses named System Colors as defaults for each of the scrollbar color properties.
See related <a href="">Issue 1956</a>.
<div class="example">
<p>The following example
(derived from
<a href=""></a>)
resets scrollbar colors in IE.</p>
<pre><code class="css">
<!-- -->html {
<!-- --> scrollbar-color: ThreeDFace Scrollbar;
<!-- -->}</code></pre>
<h2 id="scrollbar-width">Scrollbar Thickness: the 'scrollbar-width' property</h2>
<pre class="propdef">
Name: scrollbar-width
Value: auto | thin | none | <<length>>
Initial: auto
Inherited: no
Computed value: specified keyword or absolute length
Animation type: by computed value
Applies to: boxes to which 'overflow' applies
Percentages: n/a
This property allows the author to set the maximum thickness of an element’s scrollbars when they are shown.
<dl dfn-type="value" dfn-for=scrollbar-width>
<dd>implementations must use the default platform scrollbar width.
<dd>Implementations should use thinner scrollbars than auto when applicable.
This may mean a thin variant of scrollbar provided by the platform,
or a custom scrollbar thinner than the default platform scrollbar.
Note: Some platforms may only have a tiny scrollbar by default
which cannot be or makes no sense to make thinner.
In that case, implementations may treat this value as auto.
<dd>implementations must not display any scrollbar, however the element's scrollability is not affected.
<dd>When a user agent displays one or more scrollbars for an element,
the thickness of those scrollbars must be no more than the computed 'scrollbar-width' length value.
Negative <<length>> values are not allowed. If scrollbar-width computes to 0, the element’s scrollbars are hidden,
however its scrollability is not affected.
Note: There is working group disagreement about whether to allow length values,
or only have keywords (auto, thin, none), or drop the scrollbar-width property altogether.
(<a href="">Issue 1958</a>)
UAs must apply the scrollbar-width value set on the root element to the viewport.
Note: Unlike 'overflow' (and overflow-*) properties,
a scrollbar-width value set on the HTML body element is not propagated to the viewport.
Note: 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.
<h2 class="no-num" id="acknowledgments">Appendix A. Acknowledgments</h2>
This appendix is <em>informative</em>.
Thanks to the use-cases, prototyping, implementation, and feedback from
<span class="h-card">Tab Atkins</span> and
<span class="h-card">Xidorn Quan</span>.
<h2 class="no-num" id="changes">Appendix B. Changes</h2>
This appendix is <em>informative</em>.
This is the First Public Working Draft, no previous draft to describe changes from.
<!-- This appendix describes changes from the
<a href="">First Public Working Draft (FPWD) of DD Month 2018</a>.-->
<h2 class="no-num" id="security-privacy-considerations">Appendix C. Considerations for Security and Privacy</h2>
This appendix is <em>informative</em>.
Per the <a href="">
Self-Review Questionnaire: Security and Privacy: Questions to Consider</a>
<li>Does this specification deal with personally-identifiable information?
<li>Does this specification deal with high-value data?
<li>Does this specification introduce new state for an origin that persists across browsing sessions?
<li>Does this specification expose persistent, cross-origin state to the web?
<li>Does this specification expose any other data to an origin that it doesn’t currently have access to?
<li>Does this specification enable new script execution/loading mechanisms?
<li>Does this specification allow an origin access to a user’s location?
<li>Does this specification allow an origin access to sensors on a user’s device?
<li>Does this specification allow an origin access to aspects of a user’s local computing environment?
<li>Does this specification allow an origin access to other devices?
<li>Does this specification allow an origin some measure of control over a user agent’s native UI?
<p>Yes. The 'scrollbar-*' 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?
<li>Does this specification distinguish between behavior in first-party and third-party contexts?
<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?
<li>Does this specification have a "Security Considerations" and "Privacy Considerations" section?
<li>Does this specification allow downgrading default security characteristics?
You can’t perform that action at this time.