Araya
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    [↑ Jump to Table of Contents](#toc)[← Collapse Sidebar](#toc) [![W3C](https://www.w3.org/StyleSheets/TR/2016/logos/W3C)](https://www.w3.org/) CSS Cascading and Inheritance Level 4 ===================================== W3C Candidate Recommendation, 28 August 2018 -------------------------------------------- This version: [https://www.w3.org/TR/2018/CR-css-cascade-4-20180828/](https://www.w3.org/TR/2018/CR-css-cascade-4-20180828/) Latest published version: [https://www.w3.org/TR/css-cascade-4/](https://www.w3.org/TR/css-cascade-4/) Editor's Draft: [https://drafts.csswg.org/css-cascade/](https://drafts.csswg.org/css-cascade/) Previous Versions: [https://www.w3.org/TR/2016/CR-css-cascade-4-20160114/](https://www.w3.org/TR/2016/CR-css-cascade-4-20160114/) [https://www.w3.org/TR/2015/WD-css-cascade-4-20150908/](https://www.w3.org/TR/2015/WD-css-cascade-4-20150908/) [https://www.w3.org/TR/2015/WD-css-cascade-4-20150421/](https://www.w3.org/TR/2015/WD-css-cascade-4-20150421/) [https://www.w3.org/TR/2013/WD-css-cascade-3-20130730/](https://www.w3.org/TR/2013/WD-css-cascade-3-20130730/) [https://www.w3.org/TR/2013/WD-css3-cascade-20130103/](https://www.w3.org/TR/2013/WD-css3-cascade-20130103/) [https://www.w3.org/TR/2005/WD-css3-cascade-20051215/](https://www.w3.org/TR/2005/WD-css3-cascade-20051215/) Issue Tracking: [Disposition of Comments](https://drafts.csswg.org/css-cascade/issues) [GitHub Issues](https://github.com/w3c/csswg-drafts/labels/css-cascade-4) Editors: [Elika J. Etemad / fantasai](http://fantasai.inkedblade.net/contact) (Invited Expert) [Tab Atkins Jr.](http://xanthir.com/contact/) (Google) [Copyright](https://www.w3.org/Consortium/Legal/ipr-notice#Copyright) © 2018 [W3C](https://www.w3.org/)® ([MIT](http://www.csail.mit.edu/), [ERCIM](http://www.ercim.eu/), [Keio](http://www.keio.ac.jp/), [Beihang](http://ev.buaa.edu.cn/)). W3C [liability](https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer), [trademark](https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks) and [permissive document license](https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document) rules apply. * * * Abstract -------- This CSS module describes how to collate style rules and assign values to all properties on all elements. By way of cascading and inheritance, values are propagated for all properties on all elements. New in this level are the [revert](#valdef-all-revert) keyword and [<supports-condition>](#typedef-supports-condition) for the [@import](#at-ruledef-import) rule. [CSS](https://www.w3.org/TR/CSS/) is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, in speech, etc. Status of this document ----------------------- _This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the [W3C technical reports index at https://www.w3.org/TR/.](https://www.w3.org/TR/)_ This document was produced by the [CSS Working Group](https://www.w3.org/Style/CSS/members) as a Candidate Recommendation. This document is intended to become a W3C Recommendation. This document will remain a Candidate Recommendation at least until 28 October 2018 in order to ensure the opportunity for wide review. [GitHub Issues](https://github.com/w3c/csswg-drafts/issues) are preferred for discussion of this specification. When filing an issue, please put the text “css-cascade” in the title, preferably like this: “\[css-cascade\] _…summary of comment…_”. All issues and comments are [archived](https://lists.w3.org/Archives/Public/public-css-archive/), and there is also a [historical archive](https://lists.w3.org/Archives/Public/www-style/). There is no preliminary implementation report at this time. Publication as a Candidate Recommendation does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. This document was produced by a group operating under the [W3C Patent Policy](https://www.w3.org/Consortium/Patent-Policy/). W3C maintains a [public list of any patent disclosures](https://www.w3.org/2004/01/pp-impl/32061/status) made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains [Essential Claim(s)](https://www.w3.org/Consortium/Patent-Policy/#def-essential) must disclose the information in accordance with [section 6 of the W3C Patent Policy](https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure). This document is governed by the [1 February 2018 W3C Process Document](https://www.w3.org/2018/Process-20180201/). For changes since the last draft, see the [Changes](#changes) section. Table of Contents ----------------- 1. [1 Introduction](#intro) 1. [1.1 Module Interactions](#placement) 2. [2 Importing Style Sheets: the @import rule](#at-import) 1. [2.1 Conditional @import Rules](#conditional-import) 2. [2.2 Processing Stylesheet Imports](#import-processing) 3. [2.3 Content-Type of CSS Style Sheets](#content-type) 3. [3 Shorthand Properties](#shorthand) 1. [3.1 Aliasing](#aliasing) 2. [3.2 Resetting All Properties: the all property](#all-shorthand) 4. [4 Value Processing](#value-stages) 1. [4.1 Declared Values](#declared) 2. [4.2 Cascaded Values](#cascaded) 3. [4.3 Specified Values](#specified) 4. [4.4 Computed Values](#computed) 5. [4.5 Used Values](#used) 6. [4.6 Actual Values](#actual) 7. [4.7 Examples](#stages-examples) 5. [5 Filtering](#filtering) 6. [6 Cascading](#cascading) 1. [6.1 Cascading Origins](#cascading-origins) 2. [6.2 Important Declarations: the !important annotation](#importance) 3. [6.3 Precedence of Non-CSS Presentational Hints](#preshint) 7. [7 Defaulting](#defaulting) 1. [7.1 Initial Values](#initial-values) 2. [7.2 Inheritance](#inheriting) 3. [7.3 Explicit Defaulting](#defaulting-keywords) 1. [7.3.1 Resetting a Property: the initial keyword](#initial) 2. [7.3.2 Explicit Inheritance: the inherit keyword](#inherit) 3. [7.3.3 Erasing All Declarations: the unset keyword](#inherit-initial) 4. [7.3.4 Rolling Back The Cascade: the revert keyword](#default) 8. [8 Changes](#changes) 1. [8.1 Changes Since the 14 January 2016 Candidate Recommendation](#changes-2016) 2. [8.2 Changes Since the 21 April 2015 Working Draft](#changes-2015) 3. [8.3 Additions Since Level 3](#additions-l3) 4. [8.4 Additions Since Level 2](#changes-2) 9. [Acknowledgments](#acknowledgments) 10. [9 Privacy and Security Considerations](#priv-sec) 11. [Conformance](#conformance) 1. [Document conventions](#document-conventions) 2. [Conformance classes](#conform-classes) 3. [Requirements for Responsible Implementation of CSS](#conform-responsible) 1. [Partial Implementations](#conform-partial) 2. [Implementations of Unstable and Proprietary Features](#conform-future-proofing) 3. [Implementations of CR-level Features](#conform-testing) 4. [CR exit criteria](#cr-exit-criteria) 12. [Index](#index) 1. [Terms defined by this specification](#index-defined-here) 2. [Terms defined by reference](#index-defined-elsewhere) 13. [References](#references) 1. [Normative References](#normative) 2. [Informative References](#informative) 14. [Property Index](#property-index) 1\. Introduction[](#intro) -------------------------- One of the fundamental design principles of CSS is [cascading](#cascade), which allows several style sheets to influence the presentation of a document. When different declarations try to set a value for the same element/property combination, the conflicts must somehow be resolved. The opposite problem arises when no declarations try to set a the value for an element/property combination. In this case, a value is be found by way of [inheritance](#inheritance) or by looking at the property’s [initial value](#initial-value). The [cascading](#cascade) and [defaulting](#defaulting) process takes a set of declarations as input, and outputs a [specified value](#specified-value) for each property on each element. The rules for finding the specified value for all properties on all elements in the document are described in this specification. The rules for finding the specified values in the page context and its margin boxes are described in [\[css-page-3\]](#biblio-css-page-3). ### 1.1. Module Interactions[](#placement) _This section is normative._ This module replaces and extends the rules for assigning property values, cascading, and inheritance defined in [\[CSS2\]](#biblio-css2) chapter 6. Other CSS modules may expand the definitions of some of the syntax and features defined here. For example, the Media Queries Level 4 specification, when combined with this module, expands the definition of the [<media-query>](#typedef-media-query) value type as used in this specification. For the purpose of this specification, [text nodes](https://www.w3.org/TR/css-display-3/#css-text-node) are treated as [element](https://www.w3.org/TR/css-display-3/#css-element) children of their associated element, and possess the full set of properties; since they cannot be targetted by selectors all of their computed values are assigned by [defaulting](#defaulting). 2\. Importing Style Sheets: the [@import](#at-ruledef-import) rule[](#at-import) -------------------------------------------------------------------------------- The @import rule allows users to import style rules from other style sheets. If an [@import](#at-ruledef-import) rule refers to a valid stylesheet, user agents must treat the contents of the stylesheet as if they were written in place of the [@import](#at-ruledef-import) rule, with two exceptions: * If a feature (such as the @namespace rule) _explicitly_ defines that it only applies to a particular stylesheet, and not any imported ones, then it doesn’t apply to the imported stylesheet. * If a feature relies on the relative ordering of two or more constructs in a stylesheet (such as the requirement that [@charset](https://www.w3.org/TR/css-syntax-3/#at-ruledef-charset) must not have any other content preceding it), it only applies between constructs in the same stylesheet. [](#example-43537872)For example, declarations in style rules from imported stylesheets interact with the cascade as if they were written literally into the stylesheet at the point of the [@import](#at-ruledef-import). Similarly, style rules in a stylesheet imported into a scoped stylesheet are scoped in the same way. Any [@import](#at-ruledef-import) rules must precede all other at-rules and style rules in a style sheet (besides [@charset](https://www.w3.org/TR/css-syntax-3/#at-ruledef-charset), which must be the first thing in the style sheet if it exists), or else the [@import](#at-ruledef-import) rule is invalid. The syntax of [@import](#at-ruledef-import) is: @import \[ [<url>](https://www.w3.org/TR/css3-values/#url-value) [|](https://www.w3.org/TR/css3-values/#comb-one) [<string>](https://www.w3.org/TR/css3-values/#string-value) \] \[ supports( \[ [<supports-condition>](#typedef-supports-condition) [|](https://www.w3.org/TR/css3-values/#comb-one) [<declaration>](#typedef-declaration) \] ) \][?](https://www.w3.org/TR/css3-values/#mult-opt) [<media-query-list>](https://www.w3.org/TR/mediaqueries-4/#typedef-media-query-list)[?](https://www.w3.org/TR/css3-values/#mult-opt) ; where the [<url>](https://www.w3.org/TR/css3-values/#url-value) or [<string>](https://www.w3.org/TR/css3-values/#string-value) gives the URL of the style sheet to be imported, and the optional \[[<supports-condition>](#typedef-supports-condition)|[<declaration>](#typedef-declaration)\] and [<media-query-list>](https://www.w3.org/TR/mediaqueries-4/#typedef-media-query-list) (collectively, the import conditions) state the conditions under which it applies. [](#example-1ee2aea5)The following [conditional @import rule](#conditional-import) only loads the style sheet when the UA [supports](https://www.w3.org/TR/css3-conditional/#support-definition) [display: flex](https://www.w3.org/TR/css-display-3/#propdef-display), and only applies the style sheet on a [handheld](https://www.w3.org/TR/CSS2/media.html#media-types) device with a [maximum viewport width](https://www.w3.org/TR/css3-mediaqueries/#width) of 400px. @import url("narrow.css") supports(display: flex) handheld and (max-width: 400px); If a [<string>](https://www.w3.org/TR/css3-values/#string-value) is provided, it must be interpreted as a [<url>](https://www.w3.org/TR/css3-values/#url-value) with the same value. [](#example-369d998e)The following lines are equivalent in meaning and illustrate both [@import](#at-ruledef-import) syntaxes (one with [url()](https://drafts.csswg.org/css-values-4/#funcdef-url) and one with a bare string): @import "mystyle.css"; @import url("mystyle.css"); ### 2.1. Conditional [@import](#at-ruledef-import) Rules[](#conditional-import) The [import conditions](#import-conditions) allow the import to be media– or feature-support–dependent. In the absence of any [import conditions](#import-conditions), the import is unconditional. (Specifying [all](https://www.w3.org/TR/mediaqueries-4/#valdef-media-all) for the [<media-query-list>](https://www.w3.org/TR/mediaqueries-4/#typedef-media-query-list) has the same effect.) If the [import conditions](#import-conditions) do not match, the rules in the imported stylesheet do not apply, exactly as if the imported stylesheet were wrapped in [@media](https://drafts.csswg.org/css-conditional-3/#at-ruledef-media) and/or [@supports](https://drafts.csswg.org/css-conditional-3/#at-ruledef-supports) blocks with the given conditions. [](#example-5a8c291b)The following rules illustrate how [@import](#at-ruledef-import) rules can be made media-dependent: @import url("fineprint.css") print; @import url("bluish.css") projection, tv; @import url("narrow.css") handheld and (max-width: 400px); User agents may therefore avoid fetching a conditional import as long as the [import conditions](#import-conditions) do not match. Additionally, if a [<supports-condition>](#typedef-supports-condition) blocks the application of the imported style sheet, the UA _must not_ fetch the style sheet (unless it is loaded through some other link) and _must_ return null for the import rule’s CSSImportRule.styleSheet value (even if it is loaded through some other link). [](#example-3090b33a)The following rule illustrates how an author can provide fallback rules for legacy user agents without impacting network performance on newer user agents: @import url("fallback-layout.css") supports(not (display: flex)); @supports (display: flex) { ... } A [<media-query>](#typedef-media-query) corresponds to the `media_query_list` production and is interpreted as a [media query](https://www.w3.org/TR/mediaqueries-4/#media-query), and a [<supports-condition>](#typedef-supports-condition) corresponds to a `supports_condition` production and is interpreted as an [@supports](https://drafts.csswg.org/css-conditional-3/#at-ruledef-supports) condition. If a [<declaration>](#typedef-declaration) (a `declaration` production) is given in place of a [<supports-condition>](#typedef-supports-condition), it must be interpreted as a `supports_declaration_condition` production (i.e. the extra set of parentheses is implied) and treated as a [<supports-condition>](#typedef-supports-condition). [](#example-c7200cb6)For example, the following two lines are equivalent: @import "mystyle.css" supports(display: flex); @import "mystyle.css" supports((display: flex)); The evaluation and full syntax of the [import conditions](#import-conditions) are defined by the [Media Queries](https://www.w3.org/TR/css3-mediaqueries/) [\[MEDIAQ\]](#biblio-mediaq) and [CSS Conditional Rules](https://www.w3.org/TR/css-conditional/) [\[CSS3-CONDITIONAL\]](#biblio-css3-conditional) specifications. ### 2.2. Processing Stylesheet Imports[](#import-processing) When the same style sheet is imported or linked to a document in multiple places, user agents must process (or act as though they do) each link as though the link were to an independent style sheet. Note: This does not place any requirements on resource fetching, only how the style sheet is reflected in the CSSOM and used in specs such as this one. Assuming appropriate caching, it is perfectly appropriate for a UA to fetch a style sheet only once, even though it’s linked or imported multiple times. The [origin](#origin) of an imported style sheet is the [origin](#origin) of the style sheet that imported it. The [environment encoding](https://www.w3.org/TR/css-syntax-3/#environment-encoding) of an imported style sheet is the encoding of the style sheet that imported it. [\[css-syntax-3\]](#biblio-css-syntax-3) ### 2.3. Content-Type of CSS Style Sheets[](#content-type) The processing of imported style sheets depends on the actual type of the linked resource. If the resource does not have [Content-Type metadata](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#content-type), or the host document is in [quirks mode](https://html.spec.whatwg.org/multipage/infrastructure.html#quirks-mode) and has the [same origin](https://html.spec.whatwg.org/multipage/origin.html#same-origin) as the imported style sheet, the type of the linked resource is `text/css`. Otherwise, the type is determined from its [Content-Type metadata](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#content-type). If the linked resource’s type is `text/css`, it must be interpreted as a CSS style sheet. Otherwise, it must be interpreted as a network error. 3\. Shorthand Properties[](#shorthand) -------------------------------------- Some properties are shorthand properties, meaning that they allow authors to specify the values of several properties with a single property. A [shorthand property](#shorthand-property) sets all of its longhand sub-properties, exactly as if expanded in place. When values are omitted from a [shorthand](#shorthand-property) form, unless otherwise defined, each “missing” [sub-property](#longhand) is assigned its [initial value](#initial-value). This means that a [shorthand](#shorthand-property) property declaration always sets _all_ of its [sub-properties](#longhand), even those that are not explicitly set. Carelessly used, this might result in inadvertently resetting some [sub-properties](#longhand). Carefully used, a [shorthand](#shorthand-property) can guarantee a “blank slate” by resetting [sub-properties](#longhand) inadvertently cascaded from other sources. For example, writing [background: green](https://www.w3.org/TR/css3-background/#propdef-background) rather than [background-color: green](https://www.w3.org/TR/css3-background/#propdef-background-color) ensures that the background color overrides any earlier declarations that might have set the background to an image with [background-image](https://www.w3.org/TR/css3-background/#propdef-background-image). [](#example-356d27e8)For example, the CSS Level 1 [font](https://www.w3.org/TR/css-fonts-3/#propdef-font) property is a [shorthand](#shorthand-property) property for setting [font-style](https://www.w3.org/TR/css-fonts-3/#propdef-font-style), [font-variant](https://www.w3.org/TR/css-fonts-3/#propdef-font-variant), [font-weight](https://www.w3.org/TR/css-fonts-3/#propdef-font-weight), [font-size](https://www.w3.org/TR/css-fonts-3/#propdef-font-size), [line-height](https://www.w3.org/TR/CSS21/visudet.html#propdef-line-height), and [font-family](https://www.w3.org/TR/css-fonts-3/#propdef-font-family) all at once. The multiple declarations of this example: h1 { font-weight: bold; font-size: 12pt; line-height: 14pt; font-family: Helvetica; font-variant: normal; font-style: normal; } can therefore be rewritten as h1 { font: bold 12pt/14pt Helvetica } As more [font](https://www.w3.org/TR/css-fonts-3/#propdef-font) [sub-properties](#longhand) are introduced into CSS, the shorthand declaration resets those to their initial values as well. In some cases, a [shorthand](#shorthand-property) might have different syntax or special keywords that don’t directly correspond to values of its [sub-properties](#longhand). (In such cases, the [shorthand](#shorthand-property) will explicitly define the expansion of its values.) In other cases, a property might be a reset-only sub-property of the shorthand: Like other [sub-properties](#longhand), it is reset to its initial value by the shorthand when unspecified, but the shorthand might not include syntax to set the [sub-property](#longhand) to any of its other values. For example, the [border](https://www.w3.org/TR/css3-background/#propdef-border) shorthand resets [border-image](https://www.w3.org/TR/css3-background/#propdef-border-image) to its initial value of none, but has no syntax to set it to anything else. [\[css-backgrounds-3\]](#biblio-css-backgrounds-3) If a [shorthand](#shorthand-property) is specified as one of the [CSS-wide keywords](https://www.w3.org/TR/css3-values/#common-keywords) [\[css-values-3\]](#biblio-css-values-3), it sets all of its [sub-properties](#longhand) to that keyword, including any that are [reset-only sub-properties](#reset-only-sub-property). (Note that these keywords cannot be combined with other values in a single declaration, not even in a shorthand.) Declaring a [shorthand](#shorthand-property) property to be !important is equivalent to declaring all of its [sub-properties](#longhand) to be !important. ### 3.1. Aliasing[](#aliasing) Properties sometimes change names after being supported for a while, such as vendor-prefixed properties being standardized. The original name still needs to be supported for compatibility reasons, but the new name is preferred. To accomplish this, CSS defines two different ways of “aliasing” old syntax to new syntax. legacy name aliases When the old property’s syntax is identical to or a subset of the value space of the new property’s syntax, the two names are aliased with an operation on par with case-mapping: at parse time, the old property is converted into the new property. This conversion also applies in the CSSOM, both for string arguments and property accessors: requests for the old property name transparently transfer to the new property name instead. [](#example-ac57126f)For example, if old-name is a [legacy name alias](#legacy-name-alias) for new-name, `getComputedStyle(el).oldName` will return the computed style of the `newName` property, and `el.style.setPropertyValue("old-name", "value")` will set the new-name property to `"value"`. legacy shorthands When the old property has a distinct syntax from the new property, the two names are aliased using the [shorthand](#shorthand-property) mechanism. These shorthands are defined to be [legacy shorthands](#legacy-shorthand), and their use is _deprecated_. They otherwise behave exactly as regular shorthands, except that the CSSOM will not use them when serializing declarations. [\[CSSOM\]](#biblio-cssom) [](#example-fe125772)For example, the page-break-\* properties are [legacy shorthands](#legacy-shorthand) for the break-\* properties (see [CSS Fragmentation 3 §3.4 Page Break Aliases: the page-break-before, page-break-after, and page-break-inside properties](https://www.w3.org/TR/css3-break/#page-break-properties)). Setting [page-break-before: always](https://www.w3.org/TR/CSS21/page.html#propdef-page-break-before) expands to [break-before: page](https://www.w3.org/TR/css3-break/#propdef-break-before) at parse time, like other shorthands do. Similarly, if [break-before: page](https://www.w3.org/TR/css3-break/#propdef-break-before) is set, calling `getComputedStyle(el).pageBreakBefore` will return `"always"`. However, when serializing a style block (see [CSSOM 1 §5.7.2 Serializing CSS Values](https://www.w3.org/TR/cssom-1/#serializing-css-values)), the [page-break-before](https://www.w3.org/TR/CSS21/page.html#propdef-page-break-before) property will never be chosen as the shorthand to serialize to, regardless of whether it or [break-before](https://www.w3.org/TR/css3-break/#propdef-break-before) was specified; instead, [break-before](https://www.w3.org/TR/css3-break/#propdef-break-before) will always be chosen. ### 3.2. Resetting All Properties: the [all](#propdef-all) property[](#all-shorthand) Name: all [Value:](https://drafts.csswg.org/css-values/#value-defs) initial [|](https://www.w3.org/TR/css3-values/#comb-one) inherit [|](https://www.w3.org/TR/css3-values/#comb-one) unset [|](https://www.w3.org/TR/css3-values/#comb-one) revert [Initial:](https://drafts.csswg.org/css-cascade/#initial-values) see individual properties Applies to: see individual properties [Inherited:](https://drafts.csswg.org/css-cascade/#inherited-property) see individual properties [Percentages:](https://drafts.csswg.org/css-values/#percentages) see individual properties Media: see individual properties [Computed value:](https://drafts.csswg.org/css-cascade/#computed) see individual properties [Animation type:](https://drafts.csswg.org/css-transitions/#animatable-properties) see individual properties Canonical order: per grammar The [all](#propdef-all) property is a [shorthand](#shorthand-property) that resets _all_ CSS properties except [direction](https://www.w3.org/TR/css-writing-modes-3/#propdef-direction) and [unicode-bidi](https://www.w3.org/TR/css-writing-modes-3/#propdef-unicode-bidi). It only accepts the [CSS-wide keywords](https://www.w3.org/TR/css3-values/#common-keywords). It does not reset [custom properties](https://www.w3.org/TR/css-variables-1/#custom-property) [\[css-variables-1\]](#biblio-css-variables-1). Note: The excepted CSS properties [direction](https://www.w3.org/TR/css-writing-modes-3/#propdef-direction) and [unicode-bidi](https://www.w3.org/TR/css-writing-modes-3/#propdef-unicode-bidi) are actually markup-level features, and [should not be set in the author’s style sheet](https://www.w3.org/TR/css3-writing-modes/#text-direction). (They exist as CSS properties only to style document languages not supported by the UA.) Authors should use the appropriate markup, such as HTML’s `dir` attribute, instead. [\[css-writing-modes-3\]](#biblio-css-writing-modes-3) [](#example-dfc13e6d)For example, if an author specifies [all: initial](#propdef-all) on an element it will block all inheritance and reset all properties, as if no rules appeared in the author, user, or user-agent levels of the cascade. This can be useful for the root element of a "widget" included in a page, which does not wish to inherit the styles of the outer page. Note, however, that any "default" style applied to that element (such as, e.g. [display: block](https://www.w3.org/TR/css-display-3/#propdef-display) from the UA style sheet on block elements such as `<div>`) will also be blown away. 4\. Value Processing[](#value-stages) ------------------------------------- Once a user agent has parsed a document and constructed a document tree, it must assign, to every element in the tree, and correspondingly to every box in the formatting structure, a value to every property that applies to the target media type. The final value of a CSS property for a given element or box is the result of a multi-step calculation: 1. First, all the [declared values](#declared-value) applied to an element are collected, for each property on each element. There may be zero or many [declared values](#declared-value) applied to the element. 2. Cascading yields the [cascaded value](#cascaded-value). There is at most one [cascaded value](#cascaded-value) per property per element. 3. Defaulting yields the [specified value](#specified-value). Every element has exactly one [specified value](#specified-value) per property. 4. Resolving value dependencies yields the [computed value](#computed-value). Every element has exactly one [computed value](#computed-value) per property. 5. Formatting the document yields the [used value](#used-value). An element only has a [used value](#used-value) for a given property if that property applies to the element. 6. Finally, the used value is transformed to the [actual value](#actual-value) based on constraints of the display environment. As with the [used value](#used-value), there may or may not be an [actual value](#actual-value) for a given property on an element. ### 4.1. Declared Values[](#declared) Each property declaration [applied to an element](#filtering) contributes a declared value for that property associated with the element. See [Filtering Declarations](#filtering) for details. These values are then processed by the [cascade](#cascade) to choose a single “winning value”. ### 4.2. Cascaded Values[](#cascaded) The cascaded value represents the result of [the cascade](#cascade): it is the [declared value](#declared-value) that wins the cascade (is sorted first in the [output of the cascade](#output-of-the-cascade)). If the [output of the cascade](#output-of-the-cascade) is an empty list, there is no [cascaded value](#cascaded-value). ### 4.3. Specified Values[](#specified) The specified value is the value of a given property that the style sheet authors intended for that element. It is the result of putting the [cascaded value](#cascaded-value) through the [defaulting](#defaulting) processes, guaranteeing that a [specified value](#specified-value) exists for every property on every element. In many cases, the [specified value](#specified-value) is the [cascaded value](#cascaded-value). However, if there is no [cascaded value](#cascaded-value) at all, the [specified value](#specified-value) is [defaulted](#defaulting). The [CSS-wide keywords](https://www.w3.org/TR/css3-values/#css-wide-keywords) are handled specially when they are the [cascaded value](#cascaded-value) of a property, setting the [specified value](#specified-value) as required by that keyword, see [§7.3 Explicit Defaulting](#defaulting-keywords). ### 4.4. Computed Values[](#computed) The computed value is the result of resolving the [specified value](#specified-value) as defined in the “Computed Value” line of the property definition table, generally absolutizing it in preparation for [inheritance](#inheritance). Note: The [computed value](#computed-value) is the value that is transferred from parent to child during [inheritance](#inheritance). For historical reasons, it is not necessarily the value returned by the `getComputedStyle()` function. [](#example-1c172390)A [specified value](#specified-value) can be either absolute (i.e., not relative to another value, as in [red](https://www.w3.org/TR/css-color-4/#valdef-color-red) or 2mm) or relative (i.e., relative to another value, as in [auto](https://drafts.csswg.org/css-page-3/#valdef-page-size-auto), 2em). Computing a relative value generally absolutizes it: * values with relative units ([em](https://www.w3.org/TR/css3-values/#em), [ex](https://www.w3.org/TR/css3-values/#ex), [vh](https://www.w3.org/TR/css3-values/#vh), [vw](https://www.w3.org/TR/css3-values/#vw)) must be made absolute by multiplying with the appropriate reference size * certain keywords (e.g., smaller, [bolder](https://www.w3.org/TR/css-fonts-4/#valdef-font-weight-bolder)) must be replaced according to their definitions * percentages on some properties must be multiplied by a reference value (defined by the property) * valid relative URLs must be resolved to become absolute. See examples (f), (g) and (h) in the [table below](#stages-examples). Note: In general, the [computed value](#computed-value) resolves the [specified value](#specified-value) as far as possible without laying out the document or performing other expensive or hard-to-parallelize operations, such as resolving network requests or retrieving values other than from the element and its parent. The [computed value](#computed-value) exists even when the property does not apply (as defined by the “Applies To” line). However, some properties may change how they determine the [computed value](#computed-value) based on whether the property applies to the element. ### 4.5. Used Values[](#used) The used value is the result of taking the [computed value](#computed-value) and completing any remaining calculations to make it the absolute theoretical value used in the layout of the document. If the property does not apply to this element, then the element has no [used value](#used-value) for that property. [](#example-ef0b5f81)For example, a declaration of [width: auto](https://www.w3.org/TR/CSS21/visudet.html#propdef-width) can’t be resolved into a length without knowing the layout of the element’s ancestors, so the [computed value](#computed-value) is [auto](https://drafts.csswg.org/css-page-3/#valdef-page-size-auto), while the [used value](#used-value) is an absolute length, such as 100px. [\[CSS2\]](#biblio-css2) [](#example-0fa678bf)As another example, a `<div>` might have a computed [break-before](https://www.w3.org/TR/css3-break/#propdef-break-before) value of [auto](https://drafts.csswg.org/css-page-3/#valdef-page-size-auto), but acquire a used [break-before](https://www.w3.org/TR/css3-break/#propdef-break-before) value of [page](https://www.w3.org/TR/css3-break/#valdef-break-before-page) by propagation from its first child. [\[css-break-3\]](#biblio-css-break-3) [](#example-0e2bb8fc)Lastly, if a property does not apply to an element, it has no [used value](#used-value); so, for example, the [flex](https://www.w3.org/TR/css-flexbox-1/#propdef-flex) property has no [used value](#used-value) on elements that aren’t [flex items](https://www.w3.org/TR/css-flexbox-1/#flex-item). ### 4.6. Actual Values[](#actual) A [used value](#used-value) is in principle ready to be used, but a user agent may not be able to make use of the value in a given environment. For example, a user agent may only be able to render borders with integer pixel widths and may therefore have to approximate the [used](#used-value) width. Also, the font size of an element may need adjustment based on the availability of fonts or the value of the [font-size-adjust](https://www.w3.org/TR/css-fonts-4/#propdef-font-size-adjust) property. The actual value is the used value after any such adjustments have been made. Note: By probing the actual values of elements, much can be learned about how the document is laid out. However, not all information is recorded in the actual values. For example, the actual value of the [page-break-after](https://www.w3.org/TR/CSS21/page.html#propdef-page-break-after) property does not reflect whether there is a page break or not after the element. Similarly, the actual value of [orphans](https://www.w3.org/TR/css3-break/#propdef-orphans) does not reflect how many orphan lines there is in a certain element. See examples (j) and (k) in the [table below](#stages-examples). ### 4.7. Examples[](#stages-examples) Property Winning declaration Cascaded value Specified value Computed value Used value Actual value (a) [text-align](https://www.w3.org/TR/css-text-3/#propdef-text-align) `text-align: left` left left left left left (b) [border-top-width](https://www.w3.org/TR/css3-background/#propdef-border-top-width), [border-right-width](https://www.w3.org/TR/css3-background/#propdef-border-right-width), [border-bottom-width](https://www.w3.org/TR/css3-background/#propdef-border-bottom-width), [border-left-width](https://www.w3.org/TR/css3-background/#propdef-border-left-width) `border-width: inherit` inherit 4.2px 4.2px 4.2px 4px (c) [width](https://www.w3.org/TR/CSS21/visudet.html#propdef-width) (none) (none) auto (initial value) auto 120px 120px (d) [list-style-position](https://www.w3.org/TR/css-lists-3/#propdef-list-style-position) `list-style-position: inherit` inherit inside inside inside inside (e) [list-style-position](https://www.w3.org/TR/css-lists-3/#propdef-list-style-position) `list-style-position: initial` initial outside (initial value) outside outside outside (f) [font-size](https://www.w3.org/TR/css-fonts-3/#propdef-font-size) `font-size: 1.2em` 1.2em 1.2em 14.1px 14.1px 14px (g) [width](https://www.w3.org/TR/CSS21/visudet.html#propdef-width) `width: 80%` 80% 80% 80% 354.2px 354px (h) [width](https://www.w3.org/TR/CSS21/visudet.html#propdef-width) `width: auto` auto auto auto 134px 134px (i) [height](https://www.w3.org/TR/CSS21/visudet.html#propdef-height) `height: auto` auto auto auto 176px 176px (j) [page-break-after](https://www.w3.org/TR/CSS21/page.html#propdef-page-break-after) (none) (none) auto (initial value) auto auto auto (k) [orphans](https://www.w3.org/TR/css3-break/#propdef-orphans) `orphans: 3` 3 3 3 3 3 5\. Filtering[](#filtering) --------------------------- In order to find the [declared values](#declared-value), implementations must first identify all declarations that apply to each element. A declaration applies to an element if: * It belongs to a style sheet that currently applies to this document. * It is not qualified by a conditional rule [\[CSS3-CONDITIONAL\]](#biblio-css3-conditional) with a false condition. * It belongs to a style rule whose selector matches the element. [\[SELECT\]](#biblio-select) (Taking [scoping](https://www.w3.org/TR/selectors4/#scoping) into account, if necessary.) * It is syntactically valid: the declaration’s property is a known property name, and the declaration’s value matches the syntax for that property. The values of the declarations that apply form, for each property on each element, a list of [declared values](#declared-value). The next section, the [cascade](#cascade), prioritizes these lists. 6\. Cascading[](#cascading) --------------------------- The cascade takes an unordered list of [declared values](#declared-value) for a given property on a given element, sorts them by their declaration’s precedence as determined below, and outputs a single [cascaded value](#cascaded-value). The cascade sorts declarations according to the following criteria, in descending order of priority: [](#cascade-origin)Origin and Importance The [origin](#origin) of a declaration is based on where it comes from and its [importance](#important) is whether or not it is declared !important (see below). The precedence of the various [origins](#origin) is, in descending order: 1. Transition declarations [\[css-transitions-1\]](#biblio-css-transitions-1) 2. Important user agent declarations 3. Important user declarations 4. Important author declarations 5. Animation declarations [\[css-animations-1\]](#biblio-css-animations-1) 6. Normal author declarations 7. Normal user declarations 8. Normal user agent declarations Declarations from [origins](#origin) earlier in this list win over declarations from later [origins](#origin). [](#cascade-scope)Scope A declaration can be scoped to a subtree of the document so that it only affects its scoping element and that element’s descendants. For example, [\[HTML\]](#biblio-html) defines scoped `<style>` elements, whose style sheets are scoped to the element’s parent. If the [scoping elements](#scoping-element) of two declarations have an ancestor/descendant relationship, then for normal rules the declaration whose [scoping element](#scoping-element) is the descendant wins, and for important rules the declaration whose [scoping element](#scoping-element) is the ancestor wins. Note: In other words, for normal declarations the inner scope’s declarations override, but for !important rules _outer_ scope’s override. For the purpose of this step, all unscoped declarations are considered to be [scoped](#scoped) to the root element. Normal declarations from style attributes are considered to be [scoped](#scoped) to the element with the attribute, whereas important declarations from style attributes are considered to be [scoped](#scoped) to the root element. [\[CSSSTYLEATTR\]](#biblio-cssstyleattr) Note: This odd handling of !important style attribute declarations is to match the behavior defined in CSS Levels 1 and 2, where style attributes simply have higher specificity than any other author rules. [\[CSS2\]](#biblio-css2) [](#cascade-specificity)Specificity The [Selectors module](https://www.w3.org/TR/selectors/#specificity) [\[SELECT\]](#biblio-select) describes how to compute the specificity of a selector. Each declaration has the same specificity as the style rule it appears in. For the purpose of this step, declarations that do not belong to a style rule (such as the [contents of a style attribute](https://www.w3.org/TR/css-style-attr/#interpret)) are considered to have a specificity higher than any selector. The declaration with the highest specificity wins. [](#cascade-order)Order of Appearance The last declaration in document order wins. For this purpose: * Declarations from [imported style sheets](#at-ruledef-import) are ordered as if their style sheets were substituted in place of the [@import](#at-ruledef-import) rule. * Declarations from style sheets independently linked by the originating document are treated as if they were concatenated in linking order, as determined by the host document language. * Declarations from style attributes are ordered according to the document order of the element the style attribute appears on, and are all placed after any style sheets. The output of the cascade is a (potentially empty) sorted list of [declared values](#declared-value) for each property on each element. ### 6.1. Cascading Origins[](#cascading-origins) Each style rule has a cascade origin, which determines where it enters the cascade. CSS defines three core [origins](#origin): Author Origin[](#cascade-origin-author) The author specifies style sheets for a source document according to the conventions of the document language. For instance, in HTML, style sheets may be included in the document or linked externally. User Origin[](#cascade-origin-user) The user may be able to specify style information for a particular document. For example, the user may specify a file that contains a style sheet or the user agent may provide an interface that generates a user style sheet (or behaves as if it did). User Agent Origin[](#cascade-origin-ua) Conforming user agents must apply a default style sheet (or behave as if they did). A user agent’s default style sheet should present the elements of the document language in ways that satisfy general presentation expectations for the document language (e.g., for visual browsers, the EM element in HTML is presented using an italic font). See e.g. the [HTML user agent style sheet](https://html.spec.whatwg.org/multipage/rendering.html#the-css-user-agent-style-sheet-and-presentational-hints). [\[HTML\]](#biblio-html) Extensions to CSS define the following additional [origins](#origin): Animation Origin[](#cascade-origin-animation) CSS Animations [\[css-animations-1\]](#biblio-css-animations-1) generate “virtual” rules representing their effects when running. Transition Origin[](#cascade-origin-transition) Like CSS Animations, CSS Transitions [\[css-transitions-1\]](#biblio-css-transitions-1) generate “virtual” rules representing their effects when running. ### 6.2. Important Declarations: the !important annotation[](#importance) CSS attempts to create a balance of power between author and user style sheets. By default, rules in an author’s style sheet override those in a user’s style sheet, which override those in the user-agent’s default style sheet. To balance this, a declaration can be made important, which increases its weight in the cascade and inverts the order of precedence. A declaration is [important](#important) if it has a !important[](#bang-important) annotation, as defined by [\[css-syntax-3\]](#biblio-css-syntax-3). i.e. if the last two (non-whitespace, non-comment) tokens in its value are the delimiter token ! followed by the identifier token important. [](#example-7e1b5c22) \[hidden\] { display: none !important; } An [important](#important) declaration takes precedence over a normal declaration. Author and user style sheets may contain !important declarations, with user !important declarations overriding author !important declarations. This CSS feature improves accessibility of documents by giving users with special requirements (large fonts, color combinations, etc.) control over presentation. Important declarations from all origins take precedence over animations. This allows authors to override animated values in important cases. (Animated values normally override all other rules.) [\[css-animations-1\]](#biblio-css-animations-1) User agent style sheets may also contain !important declarations. These override all author and user declarations. [](#example-3eff4c7c)The first rule in the user’s style sheet in the following example contains an !important declaration, which overrides the corresponding declaration in the author’s style sheet. The declaration in the second rule will also win due to being marked !important. However, the third declaration in the user’s style sheet is not !important and will therefore lose to the second rule in the author’s style sheet (which happens to set style on a [shorthand](#shorthand-property) property). Also, the third author rule will lose to the second author rule since the second declaration is !important. This shows that !important declarations have a function also within author style sheets. /\* From the user’s style sheet \*/ p { text-indent: 1em !important } p { font-style: italic !important } p { font-size: 18pt } /\* From the author’s style sheet \*/ p { text-indent: 1.5em !important } p { font: normal 12pt sans-serif !important } p { font-size: 24pt } Property Winning value [text-indent](https://www.w3.org/TR/css-text-3/#propdef-text-indent) 1em [font-style](https://www.w3.org/TR/css-fonts-3/#propdef-font-style) [italic](https://www.w3.org/TR/css-fonts-4/#valdef-font-style-italic) [font-size](https://www.w3.org/TR/css-fonts-3/#propdef-font-size) 12pt [font-family](https://www.w3.org/TR/css-fonts-3/#propdef-font-family) sans-serif ### 6.3. Precedence of Non-CSS Presentational Hints[](#preshint) The UA may choose to honor presentational hints in a source document’s markup, for example the `bgcolor` attribute or `[s](https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-s-element)` element in [\[HTML\]](#biblio-html). All document language-based styling must be translated to corresponding CSS rules and either enter the cascade at the user agent level or be treated as author level rules with a specificity of zero placed at the start of the author style sheet. A document language may define whether a presentational hint enters at the UA or author level of the cascade; if so, the UA must behave accordingly. For example, [\[SVG11\]](#biblio-svg11) maps its presentation attributes into the author level. Note: Presentational hints entering the cascade at the UA level can be overridden by author or user styles. Presentational hints entering the cascade at the author level can be overridden by author styles, but not by non-!important user styles. Host languages should choose the appropriate level for presentational hints with these considerations in mind. 7\. Defaulting[](#defaulting) ----------------------------- When the [cascade](#cascade) does not result in a value, the [specified value](#specified-value) must be found some other way. [Inherited properties](#inherited-property) draw their defaults from their parent element through [inheritance](#inheritance); all other properties take their [initial value](#initial-value). Authors can explicitly request inheritance or initialization via the [inherit](#valdef-all-inherit) and [initial](#valdef-all-initial) keywords. ### 7.1. Initial Values[](#initial-values) Each property has an initial value, defined in the property’s definition table. If the property is not an [inherited property](#inherited-property), and the [cascade](#cascade) does not result in a value, then the [specified value](#specified-value) of the property is its [initial value](#initial-value). ### 7.2. Inheritance[](#inheriting) Inheritance propagates property values from parent elements to their children. The inherited value of a property on an element is the [computed value](#computed-value) of the property on the element’s parent element. For the root element, which has no parent element, the [inherited value](#inherited-value) is the [initial value](#initial-value) of the property. (Pseudo-elements inherit according to a fictional tag sequence described for each pseudo-element [\[SELECT\]](#biblio-select).) Some properties are inherited properties, as defined in their property definition table. This means that, unless the cascade results in a value, the value will be determined by inheritance. A property can also be explicitly inherited. See the [inherit](#valdef-all-inherit) keyword. Note: Inheritance follows the document tree and is not intercepted by [anonymous boxes](https://www.w3.org/TR/CSS2/visuren.html#box-gen), or otherwise affected by manipulations of the box tree. ### 7.3. Explicit Defaulting[](#defaulting-keywords) Several CSS-wide property values are defined below; declaring a property to have these values explicitly specifies a particular defaulting behavior. As specified in [CSS Values and Units Level 3](https://www.w3.org/TR/css3-values/#common-keywords) [\[css-values-3\]](#biblio-css-values-3), all CSS properties can accept these values. #### 7.3.1. Resetting a Property: the [initial](#valdef-all-initial) keyword[](#initial) If the [cascaded value](#cascaded-value) of a property is the [initial](#valdef-all-initial) keyword, the property’s [specified value](#specified-value) is its [initial value](#initial-value). #### 7.3.2. Explicit Inheritance: the [inherit](#valdef-all-inherit) keyword[](#inherit) If the [cascaded value](#cascaded-value) of a property is the [inherit](#valdef-all-inherit) keyword, the property’s [specified](#specified-value) and [computed values](#computed-value) are the [inherited value](#inherited-value). #### 7.3.3. Erasing All Declarations: the [unset](#valdef-all-unset) keyword[](#inherit-initial) If the [cascaded value](#cascaded-value) of a property is the [unset](#valdef-all-unset) keyword, then if it is an inherited property, this is treated as [inherit](#valdef-all-inherit), and if it is not, this is treated as [initial](#valdef-all-initial). This keyword effectively erases all [declared values](#declared-value) occurring earlier in the [cascade](#cascade), correctly inheriting or not as appropriate for the property (or all longhands of a [shorthand](#shorthand-property)). #### 7.3.4. Rolling Back The Cascade: the [revert](#valdef-all-revert) keyword[](#default) If the [cascaded value](#cascaded-value) of a property is the [revert](#valdef-all-revert) keyword, the behavior depends on the origin to which the declaration belongs: user-agent origin Equivalent to [unset](#valdef-all-unset). user origin Rolls back the [cascaded value](#cascaded-value) to the user-agent level, so that the [specified value](#specified-value) is calculated as if no author-level or user-level rules were specified for this property on this element. author origin Rolls back the [cascaded value](#cascaded-value) to the user level, so that the [specified value](#specified-value) is calculated as if no author-level rules were specified for this property on this element. For the purpose of [revert](#valdef-all-revert), this origin includes the Animation [origin](#origin). 8\. Changes[](#changes) ----------------------- ### 8.1. Changes Since the 14 January 2016 Candidate Recommendation[](#changes-2016) Non-trivial changes since the [14 January 2016 Working Draft](https://www.w3.org/TR/2016/CR-css-cascade-4-20160114/) include: * [](#change-2016-alias)Precisely defined the types of aliasing that CSS uses. ([Issue 866](https://github.com/w3c/csswg-drafts/issues/866)) See [§3.1 Aliasing](#aliasing). * [](#change-2016-revert)Clarified that [revert](#valdef-all-revert) only affects the cascaded value, not the inherited value. > user origin > > Rolls back the cascade [cascaded value](#cascaded-value) to the user-agent level, so that the [specified value](#specified-value) is calculated as if no author-level or user-level rules were specified for this property on this element . > > author origin > > Rolls back the cascade [cascaded value](#cascaded-value) to the user level, so that the [specified value](#specified-value) is calculated as if no author-level rules were specified for this property on this element . * [](#change-2016-custom-all)Clarified that [custom properties](https://www.w3.org/TR/css-variables-1/#custom-property) are not reset by the [all](#propdef-all) shorthand. ([2518](https://github.com/w3c/csswg-drafts/issues/2518)) > The [all](#propdef-all) property is a [shorthand](#shorthand-property) that resets _all_ CSS properties except [direction](https://www.w3.org/TR/css-writing-modes-3/#propdef-direction) and [unicode-bidi](https://www.w3.org/TR/css-writing-modes-3/#propdef-unicode-bidi). … It does not reset [custom properties](https://www.w3.org/TR/css-variables-1/#custom-property) [\[css-variables-1\]](#biblio-css-variables-1). * [](#change-2016-import)Defined more precisely that imported stylesheets are interpreted separately from the importing stylesheet, in terms of ordering of rules, etc. > If an [@import](#at-ruledef-import) rule refers to a valid stylesheet, user agents must treat the contents of the stylesheet as if they were written in place of the [@import](#at-ruledef-import) rule , with two exceptions: > > * If a feature (such as the @namespace rule) _explicitly_ defines that it only applies to a particular stylesheet, and not any imported ones, then it doesn’t apply to the imported stylesheet. > * If a feature relies on the relative ordering of two or more constructs in a stylesheet (such as the requirement that [@charset](https://www.w3.org/TR/css-syntax-3/#at-ruledef-charset) must not have any other content preceding it), it only applies between constructs in the same stylesheet. * [](#change-2016-text)Specified that text nodes are considered children of their parent element, and receive styles via defaulting, as their properties are now observable distinct from their inline parent’s via [display: contents](https://www.w3.org/TR/css-display-3/#propdef-display) [\[css-display-3\]](#biblio-css-display-3). > For the purpose of this specification, [text nodes](https://www.w3.org/TR/css-display-3/#css-text-node) are treated as [element](https://www.w3.org/TR/css-display-3/#css-element) children of their associated element, and possess the full set of properties; since they cannot be targetted by selectors all of their computed values are assigned by [defaulting](#defaulting). * [](#change-2016-override)Removed any mention of the obsolete “override” origin, originally defined by [DOM Level 2 Style](https://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/) and later abandoned. ([Issue 1385](https://github.com/w3c/csswg-drafts/issues/1385)) A [Disposition of Comments](https://drafts.csswg.org/css-cascade-4/issues-cr-2016) is available. ### 8.2. Changes Since the 21 April 2015 Working Draft[](#changes-2015) Changes since the [21 April 2015 Working Draft](https://www.w3.org/TR/2015/WD-css-cascade-4-20150421/) include: * Renamed default keyword to [revert](#valdef-all-revert). * Allowed dropping duplicate parentheses in supports() syntax when it only contains one declaration. ### 8.3. Additions Since Level 3[](#additions-l3) The following features have been added since [Level 3](https://www.w3.org/TR/css-cascade-3/): * Introduced [revert](#valdef-all-revert) keyword, for rolling back the cascade. * Introduced supports() syntax for supports-conditional [@import](#at-ruledef-import) rules. * Added definition of how scoped styles would cascade (deferred from Level 3) ### 8.4. Additions Since Level 2[](#changes-2) The following features have been added since [Level 2](https://www.w3.org/TR/CSS2/cascade.html): * The [all](#propdef-all) shorthand * The [unset](#valdef-all-unset) keyword * Incorporation of animations and transitions into the [cascade](#cascade). Acknowledgments[](#acknowledgments) ----------------------------------- David Baron, Tantek Çelik, Simon Sapin, and Boris Zbarsky contributed to this specification. 9\. Privacy and Security Considerations[](#priv-sec) ---------------------------------------------------- * The cascade process does not distinguish between same-origin and cross-origin stylesheets, enabling the content of cross-origin stylesheets to be inferred from the computed styles they apply to a document. * User preferences and UA defaults expressed via application of style rules are exposed by the cascade process, and can be inferred from the computed styles they apply to a document. * The [@import](#at-ruledef-import) rule does not apply the [CORS protocol](https://fetch.spec.whatwg.org/#cors-protocol) to loading cross-origin stylesheets, instead allowing them to be freely imported and applied. * The [@import](#at-ruledef-import) rule assumes that resources without [`Content-Type` metadata](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#content-type) (or any same-origin file if the host document is in quirks mode) are `text/css`, potentially allowing arbitrary files to be imported into the page and interpreted as CSS, potentially allowing sensitive data to be inferred from the computed styles they apply to a document. Conformance[](#conformance) --------------------------- ### Document conventions[](#document-conventions) 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. All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [\[RFC2119\]](#biblio-rfc2119) Examples in this specification are introduced with the words “for example” or are set apart from the normative text with `class="example"`, like this: [](#example-a13d9f9a) This is an example of an informative example. Informative notes begin with the word “Note” and are set apart from the normative text with `class="note"`, like this: Note, this is an informative note. Advisements are normative sections styled to evoke special attention and are set apart from other normative text with `<strong class="advisement">`, like this: **UAs MUST provide an accessible alternative.** ### Conformance classes[](#conform-classes) Conformance to this specification is defined for three conformance classes: style sheet A [CSS style sheet](https://www.w3.org/TR/CSS2/conform.html#style-sheet). renderer A [UA](https://www.w3.org/TR/CSS2/conform.html#user-agent) that interprets the semantics of a style sheet and renders documents that use them. authoring tool A [UA](https://www.w3.org/TR/CSS2/conform.html#user-agent) that writes a style sheet. 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. 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.) 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. ### Requirements for Responsible Implementation of CSS[](#conform-responsible) The following sections define several conformance requirements for implementing CSS responsibly, in a way that promotes interoperability in the present and future. #### Partial Implementations[](#conform-partial) So that authors can exploit the forward-compatible parsing rules to assign fallback values, **CSS renderers _must_ treat as invalid (and [ignore as appropriate](https://www.w3.org/TR/CSS2/conform.html#ignore)) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support**. In particular, user agents _must not_ selectively ignore unsupported property 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. #### Implementations of Unstable and Proprietary Features[](#conform-future-proofing) To avoid clashes with future stable CSS features, the CSSWG recommends [following best practices](https://www.w3.org/TR/CSS/#future-proofing) for the implementation of [unstable](https://www.w3.org/TR/CSS/#unstable) features and [proprietary extensions](https://www.w3.org/TR/CSS/#proprietary-extension) to CSS. #### Implementations of CR-level Features[](#conform-testing) Once a specification reaches the Candidate Recommendation stage, implementers should release an [unprefixed](https://www.w3.org/TR/CSS/#vendor-prefix) implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec, and should avoid exposing a prefixed variant of that feature. 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. Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at [https://www.w3.org/Style/CSS/Test/](https://www.w3.org/Style/CSS/Test/). Questions should be directed to the [public-css-testsuite@w3.org](https://lists.w3.org/Archives/Public/public-css-testsuite) mailing list. ### CR exit criteria[](#cr-exit-criteria) For this specification to be advanced to Proposed Recommendation, there must be at least two independent, interoperable implementations of each feature. Each feature may be implemented by a different set of products, there is no requirement that all features be implemented by a single product. For the purposes of this criterion, we define the following terms: independent each implementation must be developed by a different party and cannot share, reuse, or derive from code used by another qualifying implementation. Sections of code that have no bearing on the implementation of this specification are exempt from this requirement. interoperable passing the respective test case(s) in the official CSS test suite, or, if the implementation is not a Web browser, an equivalent test. Every relevant test in the test suite should have an equivalent test created if such a user agent (UA) is to be used to claim interoperability. In addition if such a UA is to be used to claim interoperability, then there must one or more additional UAs which can also pass those equivalent tests in the same way for the purpose of interoperability. The equivalent tests must be made publicly available for the purposes of peer review. implementation a user agent which: 1. implements the specification. 2. is available to the general public. The implementation may be a shipping product or other publicly available version (i.e., beta version, preview release, or "nightly build"). Non-shipping product releases must have implemented the feature(s) for a period of at least one month in order to demonstrate stability. 3. is not experimental (i.e., a version specifically designed to pass the test suite and is not intended for normal usage going forward). The specification will remain Candidate Recommendation for at least six months. **Support:**Android Browser4.4.3+Baidu Browser7.12+Blackberry BrowserNoneChrome37+Chrome for Android66+EdgeNoneFirefox27+Firefox for Android60+IENoneIE MobileNoneOpera24+Opera MiniNoneOpera Mobile46+QQ Browser1.2+Safari9.1+Samsung Internet4+UC Browser for Android11.8+iOS Safari9.3+ Source: [caniuse.com](https://caniuse.com/#feat=css-all) as of 2018-06-15 **Support:**Android Browser2.3+Baidu Browser7.12+Blackberry Browser7+Chrome4+Chrome for Android66+Edge12+Firefox19+Firefox for Android60+IENoneIE MobileNoneOpera15+Opera MiniNoneOpera Mobile46+QQ Browser1.2+Safari3.2+Samsung Internet4+UC Browser for Android11.8+iOS Safari4.0+ Source: [caniuse.com](https://caniuse.com/#feat=css-initial-value) as of 2018-06-15 **Support:**Android Browser66+Baidu Browser7.12+Blackberry BrowserNoneChrome41+Chrome for Android66+Edge13+Firefox27+Firefox for Android60+IENoneIE MobileNoneOpera28+Opera MiniNoneOpera MobileNoneQQ BrowserNoneSafari9.1+Samsung Internet4+UC Browser for Android11.8+iOS Safari9.3+ Source: [caniuse.com](https://caniuse.com/#feat=css-unset-value) as of 2018-06-15 **Support:**Android BrowserNoneBaidu BrowserNoneBlackberry BrowserNoneChromeNoneChrome for AndroidNoneEdgeNoneFirefoxNoneFirefox for AndroidNoneIENoneIE MobileNoneOperaNoneOpera MiniNoneOpera MobileNoneQQ BrowserNoneSafari9.1+Samsung InternetNoneUC Browser for AndroidNoneiOS Safari9.3+ Source: [caniuse.com](https://caniuse.com/#feat=css-revert-value) as of 2018-06-15 Index[](#index) --------------- ### Terms defined by this specification[](#index-defined-here) * [actual value](#actual-value), in §4.6 * [all](#propdef-all), in §3.2 * [Animation Origin](#cascade-origin-animation), in §6.1 * [author origin](#cascade-origin-author), in §6.1 * [author style sheet](#cascade-origin-author), in §6.1 * [cascade](#cascade), in §6 * [cascaded value](#cascaded-value), in §4.2 * [cascade origin](#origin), in §6.1 * [computed value](#computed-value), in §4.4 * [<declaration>](#typedef-declaration), in §2.1 * [declared value](#declared-value), in §4.1 * [@import](#at-ruledef-import), in §2 * [!important](#bang-important), in §6.2 * [important](#important), in §6.2 * [import conditions](#import-conditions), in §2 * inherit * [definition of](#inheritance), in §7.2 * [value for all](#valdef-all-inherit), in §7.3.2 * [inheritance](#inheritance), in §7.2 * [inherited property](#inherited-property), in §7.2 * [inherited value](#inherited-value), in §7.2 * [initial](#valdef-all-initial), in §7.3.1 * [initial value](#initial-value), in §7.1 * [legacy name alias](#legacy-name-alias), in §3.1 * [legacy shorthand](#legacy-shorthand), in §3.1 * [longhand](#longhand), in §3 * [longhand property](#longhand), in §3 * [<media-query>](#typedef-media-query), in §2.1 * [origin](#origin), in §6.1 * [output of the cascade](#output-of-the-cascade), in §6 * [reset-only sub-property](#reset-only-sub-property), in §3 * [revert](#valdef-all-revert), in §7.3.4 * [scoped](#scoped), in §6 * [scoping element](#scoping-element), in §6 * [shorthand](#shorthand-property), in §3 * [shorthand property](#shorthand-property), in §3 * [specified value](#specified-value), in §4.3 * [sub-property](#longhand), in §3 * [<supports-condition>](#typedef-supports-condition), in §2.1 * [Transition Origin](#cascade-origin-transition), in §6.1 * [ua origin](#cascade-origin-ua), in §6.1 * [ua style sheet](#cascade-origin-ua), in §6.1 * [unset](#valdef-all-unset), in §7.3.3 * [used value](#used-value), in §4.5 * [user agent origin](#cascade-origin-ua), in §6.1 * [user agent style sheet](#cascade-origin-ua), in §6.1 * [user origin](#cascade-origin-user), in §6.1 * [user style sheet](#cascade-origin-user), in §6.1 ### Terms defined by reference[](#index-defined-elsewhere) * \[css-backgrounds-3\] defines the following terms: * [background](https://www.w3.org/TR/css3-background/#propdef-background) * [background-color](https://www.w3.org/TR/css3-background/#propdef-background-color) * [background-image](https://www.w3.org/TR/css3-background/#propdef-background-image) * [border](https://www.w3.org/TR/css3-background/#propdef-border) * [border-bottom-width](https://www.w3.org/TR/css3-background/#propdef-border-bottom-width) * [border-image](https://www.w3.org/TR/css3-background/#propdef-border-image) * [border-left-width](https://www.w3.org/TR/css3-background/#propdef-border-left-width) * [border-right-width](https://www.w3.org/TR/css3-background/#propdef-border-right-width) * [border-top-width](https://www.w3.org/TR/css3-background/#propdef-border-top-width) * \[css-break-3\] defines the following terms: * [break-before](https://www.w3.org/TR/css3-break/#propdef-break-before) * [orphans](https://www.w3.org/TR/css3-break/#propdef-orphans) * [page](https://www.w3.org/TR/css3-break/#valdef-break-before-page) * \[css-color-4\] defines the following terms: * [red](https://www.w3.org/TR/css-color-4/#valdef-color-red) * \[css-conditional-3\] defines the following terms: * [@media](https://drafts.csswg.org/css-conditional-3/#at-ruledef-media) * [@supports](https://drafts.csswg.org/css-conditional-3/#at-ruledef-supports) * \[css-display-3\] defines the following terms: * [display](https://www.w3.org/TR/css-display-3/#propdef-display) * [element](https://www.w3.org/TR/css-display-3/#css-element) * [text node](https://www.w3.org/TR/css-display-3/#css-text-node) * \[css-flexbox-1\] defines the following terms: * [flex](https://www.w3.org/TR/css-flexbox-1/#propdef-flex) * [flex item](https://www.w3.org/TR/css-flexbox-1/#flex-item) * \[css-fonts-3\] defines the following terms: * [font](https://www.w3.org/TR/css-fonts-3/#propdef-font) * [font-family](https://www.w3.org/TR/css-fonts-3/#propdef-font-family) * [font-size](https://www.w3.org/TR/css-fonts-3/#propdef-font-size) * [font-style](https://www.w3.org/TR/css-fonts-3/#propdef-font-style) * [font-variant](https://www.w3.org/TR/css-fonts-3/#propdef-font-variant) * [font-weight](https://www.w3.org/TR/css-fonts-3/#propdef-font-weight) * \[css-fonts-4\] defines the following terms: * [bolder](https://www.w3.org/TR/css-fonts-4/#valdef-font-weight-bolder) * [font-size-adjust](https://www.w3.org/TR/css-fonts-4/#propdef-font-size-adjust) * [italic](https://www.w3.org/TR/css-fonts-4/#valdef-font-style-italic) * \[css-lists-3\] defines the following terms: * [list-style-position](https://www.w3.org/TR/css-lists-3/#propdef-list-style-position) * \[css-page-3\] defines the following terms: * [auto](https://drafts.csswg.org/css-page-3/#valdef-page-size-auto) * \[css-syntax-3\] defines the following terms: * [@charset](https://www.w3.org/TR/css-syntax-3/#at-ruledef-charset) * [environment encoding](https://www.w3.org/TR/css-syntax-3/#environment-encoding) * \[css-text-3\] defines the following terms: * [text-align](https://www.w3.org/TR/css-text-3/#propdef-text-align) * [text-indent](https://www.w3.org/TR/css-text-3/#propdef-text-indent) * \[css-values-3\] defines the following terms: * [<string>](https://www.w3.org/TR/css3-values/#string-value) * [<url>](https://www.w3.org/TR/css3-values/#url-value) * [?](https://www.w3.org/TR/css3-values/#mult-opt) * [css-wide keywords](https://www.w3.org/TR/css3-values/#css-wide-keywords) * [em](https://www.w3.org/TR/css3-values/#em) * [ex](https://www.w3.org/TR/css3-values/#ex) * [url()](https://drafts.csswg.org/css-values-4/#funcdef-url) * [vh](https://www.w3.org/TR/css3-values/#vh) * [vw](https://www.w3.org/TR/css3-values/#vw) * [|](https://www.w3.org/TR/css3-values/#comb-one) * \[css-variables-1\] defines the following terms: * [custom property](https://www.w3.org/TR/css-variables-1/#custom-property) * \[css-writing-modes-3\] defines the following terms: * [direction](https://www.w3.org/TR/css-writing-modes-3/#propdef-direction) * [unicode-bidi](https://www.w3.org/TR/css-writing-modes-3/#propdef-unicode-bidi) * \[CSS2\] defines the following terms: * [height](https://www.w3.org/TR/CSS21/visudet.html#propdef-height) * [line-height](https://www.w3.org/TR/CSS21/visudet.html#propdef-line-height) * [page-break-after](https://www.w3.org/TR/CSS21/page.html#propdef-page-break-after) * [page-break-before](https://www.w3.org/TR/CSS21/page.html#propdef-page-break-before) * [width](https://www.w3.org/TR/CSS21/visudet.html#propdef-width) * \[FETCH\] defines the following terms: * [cors protocol](https://fetch.spec.whatwg.org/#cors-protocol) * \[HTML\] defines the following terms: * [s](https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-s-element) * \[MEDIAQ\] defines the following terms: * [<media-query-list>](https://www.w3.org/TR/mediaqueries-4/#typedef-media-query-list) * [all](https://www.w3.org/TR/mediaqueries-4/#valdef-media-all) * [media query](https://www.w3.org/TR/mediaqueries-4/#media-query) References[](#references) ------------------------- ### Normative References[](#normative) \[CSS-ANIMATIONS-1\] Dean Jackson; et al. [CSS Animations Level 1](https://www.w3.org/TR/css-animations-1/). 30 November 2017. WD. URL: [https://www.w3.org/TR/css-animations-1/](https://www.w3.org/TR/css-animations-1/) \[CSS-BACKGROUNDS-3\] Bert Bos; Elika Etemad; Brad Kemper. [CSS Backgrounds and Borders Module Level 3](https://www.w3.org/TR/css-backgrounds-3/). 17 October 2017. CR. URL: [https://www.w3.org/TR/css-backgrounds-3/](https://www.w3.org/TR/css-backgrounds-3/) \[CSS-BREAK-3\] Rossen Atanassov; Elika Etemad. [CSS Fragmentation Module Level 3](https://www.w3.org/TR/css-break-3/). 9 February 2017. CR. URL: [https://www.w3.org/TR/css-break-3/](https://www.w3.org/TR/css-break-3/) \[CSS-CONDITIONAL-3\] CSS Conditional Rules Module Level 3 URL: [https://www.w3.org/TR/css3-conditional/](https://www.w3.org/TR/css3-conditional/) \[CSS-DISPLAY-3\] Tab Atkins Jr.; Elika Etemad. [CSS Display Module Level 3](https://www.w3.org/TR/css-display-3/). 20 April 2018. WD. URL: [https://www.w3.org/TR/css-display-3/](https://www.w3.org/TR/css-display-3/) \[CSS-FONTS-3\] John Daggett. [CSS Fonts Module Level 3](https://www.w3.org/TR/css-fonts-3/). 15 March 2018. CR. URL: [https://www.w3.org/TR/css-fonts-3/](https://www.w3.org/TR/css-fonts-3/) \[CSS-FONTS-4\] John Daggett; Myles Maxfield. [CSS Fonts Module Level 4](https://www.w3.org/TR/css-fonts-4/). 10 April 2018. WD. URL: [https://www.w3.org/TR/css-fonts-4/](https://www.w3.org/TR/css-fonts-4/) \[CSS-LISTS-3\] Tab Atkins Jr.. [CSS Lists and Counters Module Level 3](https://www.w3.org/TR/css-lists-3/). 20 March 2014. WD. URL: [https://www.w3.org/TR/css-lists-3/](https://www.w3.org/TR/css-lists-3/) \[CSS-SYNTAX-3\] Tab Atkins Jr.; Simon Sapin. [CSS Syntax Module Level 3](https://www.w3.org/TR/css-syntax-3/). 20 February 2014. CR. URL: [https://www.w3.org/TR/css-syntax-3/](https://www.w3.org/TR/css-syntax-3/) \[CSS-TEXT-3\] Elika Etemad; Koji Ishii. [CSS Text Module Level 3](https://www.w3.org/TR/css-text-3/). 22 August 2017. WD. URL: [https://www.w3.org/TR/css-text-3/](https://www.w3.org/TR/css-text-3/) \[CSS-TRANSITIONS-1\] David Baron; Dean Jackson; Brian Birtles. [CSS Transitions](https://www.w3.org/TR/css-transitions-1/). 30 November 2017. WD. URL: [https://www.w3.org/TR/css-transitions-1/](https://www.w3.org/TR/css-transitions-1/) \[CSS-VALUES-3\] Tab Atkins Jr.; Elika Etemad. [CSS Values and Units Module Level 3](https://www.w3.org/TR/css-values-3/). 29 September 2016. CR. URL: [https://www.w3.org/TR/css-values-3/](https://www.w3.org/TR/css-values-3/) \[CSS-VARIABLES-1\] Tab Atkins Jr.. [CSS Custom Properties for Cascading Variables Module Level 1](https://www.w3.org/TR/css-variables-1/). 3 December 2015. CR. URL: [https://www.w3.org/TR/css-variables-1/](https://www.w3.org/TR/css-variables-1/) \[CSS-WRITING-MODES-3\] Elika Etemad; Koji Ishii. [CSS Writing Modes Level 3](https://www.w3.org/TR/css-writing-modes-3/). 24 May 2018. CR. URL: [https://www.w3.org/TR/css-writing-modes-3/](https://www.w3.org/TR/css-writing-modes-3/) \[CSS2\] Bert Bos; et al. [Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification](https://www.w3.org/TR/CSS2/). 7 June 2011. REC. URL: [https://www.w3.org/TR/CSS2/](https://www.w3.org/TR/CSS2/) \[CSS3-CONDITIONAL\] David Baron. [CSS Conditional Rules Module Level 3](https://www.w3.org/TR/css3-conditional/). 4 April 2013. CR. URL: [https://www.w3.org/TR/css3-conditional/](https://www.w3.org/TR/css3-conditional/) \[CSSSTYLEATTR\] Tantek Çelik; Elika Etemad. [CSS Style Attributes](https://www.w3.org/TR/css-style-attr/). 7 November 2013. REC. URL: [https://www.w3.org/TR/css-style-attr/](https://www.w3.org/TR/css-style-attr/) \[FETCH\] Anne van Kesteren. [Fetch Standard](https://fetch.spec.whatwg.org/). Living Standard. URL: [https://fetch.spec.whatwg.org/](https://fetch.spec.whatwg.org/) \[HTML\] Anne van Kesteren; et al. [HTML Standard](https://html.spec.whatwg.org/multipage/). Living Standard. URL: [https://html.spec.whatwg.org/multipage/](https://html.spec.whatwg.org/multipage/) \[MEDIAQ\] Florian Rivoal; Tab Atkins Jr.. [Media Queries Level 4](https://www.w3.org/TR/mediaqueries-4/). 5 September 2017. CR. URL: [https://www.w3.org/TR/mediaqueries-4/](https://www.w3.org/TR/mediaqueries-4/) \[RFC2119\] S. Bradner. [Key words for use in RFCs to Indicate Requirement Levels](https://tools.ietf.org/html/rfc2119). March 1997. Best Current Practice. URL: [https://tools.ietf.org/html/rfc2119](https://tools.ietf.org/html/rfc2119) \[SELECT\] Tantek Çelik; et al. [Selectors Level 3](https://www.w3.org/TR/selectors-3/). 30 January 2018. CR. URL: [https://www.w3.org/TR/selectors-3/](https://www.w3.org/TR/selectors-3/) ### Informative References[](#informative) \[CSS-COLOR-4\] Tab Atkins Jr.; Chris Lilley. [CSS Color Module Level 4](https://www.w3.org/TR/css-color-4/). 5 July 2016. WD. URL: [https://www.w3.org/TR/css-color-4/](https://www.w3.org/TR/css-color-4/) \[CSS-FLEXBOX-1\] Tab Atkins Jr.; Elika Etemad; Rossen Atanassov. [CSS Flexible Box Layout Module Level 1](https://www.w3.org/TR/css-flexbox-1/). 19 October 2017. CR. URL: [https://www.w3.org/TR/css-flexbox-1/](https://www.w3.org/TR/css-flexbox-1/) \[CSS-PAGE-3\] Melinda Grant; et al. [CSS Paged Media Module Level 3](https://www.w3.org/TR/css3-page/). 14 March 2013. WD. URL: [https://www.w3.org/TR/css3-page/](https://www.w3.org/TR/css3-page/) \[CSSOM\] Simon Pieters; Glenn Adams. [CSS Object Model (CSSOM)](https://www.w3.org/TR/cssom-1/). 17 March 2016. WD. URL: [https://www.w3.org/TR/cssom-1/](https://www.w3.org/TR/cssom-1/) \[SVG11\] Erik Dahlström; et al. [Scalable Vector Graphics (SVG) 1.1 (Second Edition)](https://www.w3.org/TR/SVG11/). 16 August 2011. REC. URL: [https://www.w3.org/TR/SVG11/](https://www.w3.org/TR/SVG11/) Property Index[](#property-index) --------------------------------- Name Value Initial Applies to Inh. %ages Media Anim­ation type Canonical order Com­puted value [all](#propdef-all) initial | inherit | unset | revert see individual properties see individual properties see individual properties see individual properties see individual properties see individual properties per grammar see individual properties **[#at-ruledef-import](#at-ruledef-import)****Referenced in:** * [2\. Importing Style Sheets: the @import rule](#ref-for-at-ruledef-import①) [(2)](#ref-for-at-ruledef-import②) [(3)](#ref-for-at-ruledef-import③) [(4)](#ref-for-at-ruledef-import④) [(5)](#ref-for-at-ruledef-import⑤) [(6)](#ref-for-at-ruledef-import⑥) [(7)](#ref-for-at-ruledef-import⑦) [(8)](#ref-for-at-ruledef-import⑧) * [2.1. Conditional @import Rules](#ref-for-at-ruledef-import⑨) [(2)](#ref-for-at-ruledef-import①⓪) * [6\. Cascading](#ref-for-at-ruledef-import①①) [(2)](#ref-for-at-ruledef-import①②) * [8.1. Changes Since the 14 January 2016 Candidate Recommendation](#ref-for-at-ruledef-import①③) [(2)](#ref-for-at-ruledef-import①④) * [8.3. Additions Since Level 3](#ref-for-at-ruledef-import①⑤) * [9\. Privacy and Security Considerations](#ref-for-at-ruledef-import①⑥) [(2)](#ref-for-at-ruledef-import①⑦) **[#import-conditions](#import-conditions)****Referenced in:** * [2.1. Conditional @import Rules](#ref-for-import-conditions) [(2)](#ref-for-import-conditions①) [(3)](#ref-for-import-conditions②) [(4)](#ref-for-import-conditions③) [(5)](#ref-for-import-conditions④) **[#typedef-media-query](#typedef-media-query)****Referenced in:** * [1.1. Module Interactions](#ref-for-typedef-media-query) * [2.1. Conditional @import Rules](#ref-for-typedef-media-query①) **[#typedef-supports-condition](#typedef-supports-condition)****Referenced in:** * [2\. Importing Style Sheets: the @import rule](#ref-for-typedef-supports-condition①) [(2)](#ref-for-typedef-supports-condition②) * [2.1. Conditional @import Rules](#ref-for-typedef-supports-condition③) [(2)](#ref-for-typedef-supports-condition④) [(3)](#ref-for-typedef-supports-condition⑤) [(4)](#ref-for-typedef-supports-condition⑥) **[#typedef-declaration](#typedef-declaration)****Referenced in:** * [2\. Importing Style Sheets: the @import rule](#ref-for-typedef-declaration) [(2)](#ref-for-typedef-declaration①) * [2.1. Conditional @import Rules](#ref-for-typedef-declaration②) **[#shorthand-property](#shorthand-property)****Referenced in:** * [3\. Shorthand Properties](#ref-for-shorthand-property) [(2)](#ref-for-shorthand-property①) [(3)](#ref-for-shorthand-property②) [(4)](#ref-for-shorthand-property③) [(5)](#ref-for-shorthand-property④) [(6)](#ref-for-shorthand-property⑤) [(7)](#ref-for-shorthand-property⑥) [(8)](#ref-for-shorthand-property⑦) [(9)](#ref-for-shorthand-property⑧) * [3.1. Aliasing](#ref-for-shorthand-property⑨) * [3.2. Resetting All Properties: the all property](#ref-for-shorthand-property①⓪) * [6.2. Important Declarations: the !important annotation](#ref-for-shorthand-property①①) * [7.3.3. Erasing All Declarations: the unset keyword](#ref-for-shorthand-property①②) * [8.1. Changes Since the 14 January 2016 Candidate Recommendation](#ref-for-shorthand-property①③) **[#longhand](#longhand)****Referenced in:** * [3\. Shorthand Properties](#ref-for-longhand) [(2)](#ref-for-longhand①) [(3)](#ref-for-longhand②) [(4)](#ref-for-longhand③) [(5)](#ref-for-longhand④) [(6)](#ref-for-longhand⑤) [(7)](#ref-for-longhand⑥) [(8)](#ref-for-longhand⑦) [(9)](#ref-for-longhand⑧) [(10)](#ref-for-longhand⑨) **[#reset-only-sub-property](#reset-only-sub-property)****Referenced in:** * [3\. Shorthand Properties](#ref-for-reset-only-sub-property) **[#legacy-name-alias](#legacy-name-alias)****Referenced in:** * [3.1. Aliasing](#ref-for-legacy-name-alias) **[#legacy-shorthand](#legacy-shorthand)****Referenced in:** * [3.1. Aliasing](#ref-for-legacy-shorthand) [(2)](#ref-for-legacy-shorthand①) **[#propdef-all](#propdef-all)****Referenced in:** * [3.2. Resetting All Properties: the all property](#ref-for-propdef-all) [(2)](#ref-for-propdef-all①) [(3)](#ref-for-propdef-all②) * [8.1. Changes Since the 14 January 2016 Candidate Recommendation](#ref-for-propdef-all③) [(2)](#ref-for-propdef-all④) * [8.4. Additions Since Level 2](#ref-for-propdef-all⑤) **[#declared-value](#declared-value)****Referenced in:** * [4\. Value Processing](#ref-for-declared-value) [(2)](#ref-for-declared-value①) * [4.2. Cascaded Values](#ref-for-declared-value②) * [5\. Filtering](#ref-for-declared-value③) [(2)](#ref-for-declared-value④) * [6\. Cascading](#ref-for-declared-value⑤) [(2)](#ref-for-declared-value⑥) * [7.3.3. Erasing All Declarations: the unset keyword](#ref-for-declared-value⑦) **[#cascaded-value](#cascaded-value)****Referenced in:** * [4\. Value Processing](#ref-for-cascaded-value) [(2)](#ref-for-cascaded-value①) * [4.2. Cascaded Values](#ref-for-cascaded-value②) * [4.3. Specified Values](#ref-for-cascaded-value③) [(2)](#ref-for-cascaded-value④) [(3)](#ref-for-cascaded-value⑤) [(4)](#ref-for-cascaded-value⑥) * [6\. Cascading](#ref-for-cascaded-value⑦) * [7.3.1. Resetting a Property: the initial keyword](#ref-for-cascaded-value⑧) * [7.3.2. Explicit Inheritance: the inherit keyword](#ref-for-cascaded-value⑨) * [7.3.3. Erasing All Declarations: the unset keyword](#ref-for-cascaded-value①⓪) * [7.3.4. Rolling Back The Cascade: the revert keyword](#ref-for-cascaded-value①①) [(2)](#ref-for-cascaded-value①②) [(3)](#ref-for-cascaded-value①③) * [8.1. Changes Since the 14 January 2016 Candidate Recommendation](#ref-for-cascaded-value①④) [(2)](#ref-for-cascaded-value①⑤) **[#specified-value](#specified-value)****Referenced in:** * [1\. Introduction](#ref-for-specified-value) * [4\. Value Processing](#ref-for-specified-value①) [(2)](#ref-for-specified-value②) * [4.3. Specified Values](#ref-for-specified-value③) [(2)](#ref-for-specified-value④) [(3)](#ref-for-specified-value⑤) [(4)](#ref-for-specified-value⑥) * [4.4. Computed Values](#ref-for-specified-value⑦) [(2)](#ref-for-specified-value⑧) [(3)](#ref-for-specified-value⑨) * [7\. Defaulting](#ref-for-specified-value①⓪) * [7.1. Initial Values](#ref-for-specified-value①①) * [7.3.1. Resetting a Property: the initial keyword](#ref-for-specified-value①②) * [7.3.2. Explicit Inheritance: the inherit keyword](#ref-for-specified-value①③) * [7.3.4. Rolling Back The Cascade: the revert keyword](#ref-for-specified-value①④) [(2)](#ref-for-specified-value①⑤) * [8.1. Changes Since the 14 January 2016 Candidate Recommendation](#ref-for-specified-value①⑥) [(2)](#ref-for-specified-value①⑦) **[#computed-value](#computed-value)****Referenced in:** * [4\. Value Processing](#ref-for-computed-value) [(2)](#ref-for-computed-value①) * [4.4. Computed Values](#ref-for-computed-value②) [(2)](#ref-for-computed-value③) [(3)](#ref-for-computed-value④) [(4)](#ref-for-computed-value⑤) * [4.5. Used Values](#ref-for-computed-value⑥) [(2)](#ref-for-computed-value⑦) * [7.2. Inheritance](#ref-for-computed-value⑧) * [7.3.2. Explicit Inheritance: the inherit keyword](#ref-for-computed-value⑨) **[#used-value](#used-value)****Referenced in:** * [4\. Value Processing](#ref-for-used-value) [(2)](#ref-for-used-value①) [(3)](#ref-for-used-value②) * [4.5. Used Values](#ref-for-used-value③) [(2)](#ref-for-used-value④) [(3)](#ref-for-used-value⑤) [(4)](#ref-for-used-value⑥) * [4.6. Actual Values](#ref-for-used-value⑦) [(2)](#ref-for-used-value⑧) **[#actual-value](#actual-value)****Referenced in:** * [4\. Value Processing](#ref-for-actual-value) [(2)](#ref-for-actual-value①) **[#cascade](#cascade)****Referenced in:** * [1\. Introduction](#ref-for-cascade) [(2)](#ref-for-cascade) * [4.1. Declared Values](#ref-for-cascade①) * [4.2. Cascaded Values](#ref-for-cascade) * [5\. Filtering](#ref-for-cascade②) * [7\. Defaulting](#ref-for-cascade③) * [7.1. Initial Values](#ref-for-cascade④) * [7.3.3. Erasing All Declarations: the unset keyword](#ref-for-cascade⑤) * [8.4. Additions Since Level 2](#ref-for-cascade⑥) **[#scoped](#scoped)****Referenced in:** * [6\. Cascading](#ref-for-scoped) [(2)](#ref-for-scoped①) [(3)](#ref-for-scoped②) **[#scoping-element](#scoping-element)****Referenced in:** * [6\. Cascading](#ref-for-scoping-element) [(2)](#ref-for-scoping-element①) [(3)](#ref-for-scoping-element②) **[#output-of-the-cascade](#output-of-the-cascade)****Referenced in:** * [4.2. Cascaded Values](#ref-for-output-of-the-cascade) [(2)](#ref-for-output-of-the-cascade①) **[#origin](#origin)****Referenced in:** * [2.2. Processing Stylesheet Imports](#ref-for-origin) [(2)](#ref-for-origin①) * [6\. Cascading](#ref-for-origin②) [(2)](#ref-for-origin③) [(3)](#ref-for-origin④) [(4)](#ref-for-origin⑤) * [6.1. Cascading Origins](#ref-for-origin⑥) [(2)](#ref-for-origin⑦) * [7.3.4. Rolling Back The Cascade: the revert keyword](#ref-for-origin⑧) **[#important](#important)****Referenced in:** * [6\. Cascading](#ref-for-important) * [6.2. Important Declarations: the !important annotation](#ref-for-important①) [(2)](#ref-for-important②) **[#initial-value](#initial-value)****Referenced in:** * [1\. Introduction](#ref-for-initial-value) * [3\. Shorthand Properties](#ref-for-initial-value①) * [7\. Defaulting](#ref-for-initial-value②) * [7.1. Initial Values](#ref-for-initial-value③) * [7.2. Inheritance](#ref-for-initial-value④) * [7.3.1. Resetting a Property: the initial keyword](#ref-for-initial-value⑤) **[#inheritance](#inheritance)****Referenced in:** * [1\. Introduction](#ref-for-inheritance) * [4.4. Computed Values](#ref-for-inheritance①) [(2)](#ref-for-inheritance②) * [7\. Defaulting](#ref-for-inheritance③) **[#inherited-value](#inherited-value)****Referenced in:** * [7.2. Inheritance](#ref-for-inherited-value) * [7.3.2. Explicit Inheritance: the inherit keyword](#ref-for-inherited-value①) **[#inherited-property](#inherited-property)****Referenced in:** * [7\. Defaulting](#ref-for-inherited-property) * [7.1. Initial Values](#ref-for-inherited-property①) **[#valdef-all-initial](#valdef-all-initial)****Referenced in:** * [7\. Defaulting](#ref-for-valdef-all-initial) * [7.3.1. Resetting a Property: the initial keyword](#ref-for-valdef-all-initial①) [(2)](#ref-for-valdef-all-initial②) * [7.3.3. Erasing All Declarations: the unset keyword](#ref-for-valdef-all-initial③) **[#valdef-all-inherit](#valdef-all-inherit)****Referenced in:** * [7\. Defaulting](#ref-for-valdef-all-inherit) * [7.2. Inheritance](#ref-for-valdef-all-inherit①) * [7.3.2. Explicit Inheritance: the inherit keyword](#ref-for-valdef-all-inherit②) [(2)](#ref-for-valdef-all-inherit③) * [7.3.3. Erasing All Declarations: the unset keyword](#ref-for-valdef-all-inherit④) **[#valdef-all-unset](#valdef-all-unset)****Referenced in:** * [7.3.3. Erasing All Declarations: the unset keyword](#ref-for-valdef-all-unset) [(2)](#ref-for-valdef-all-unset①) * [7.3.4. Rolling Back The Cascade: the revert keyword](#ref-for-valdef-all-unset②) * [8.4. Additions Since Level 2](#ref-for-valdef-all-unset③) **[#valdef-all-revert](#valdef-all-revert)****Referenced in:** * [7.3.4. Rolling Back The Cascade: the revert keyword](#ref-for-valdef-all-revert①) [(2)](#ref-for-valdef-all-revert②) [(3)](#ref-for-valdef-all-revert③) * [8.1. Changes Since the 14 January 2016 Candidate Recommendation](#ref-for-valdef-all-revert④) * [8.2. Changes Since the 21 April 2015 Working Draft](#ref-for-valdef-all-revert⑤) * [8.3. Additions Since Level 3](#ref-for-valdef-all-revert⑥)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully