GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing drafts.csswg.org — CSS Cascading and Inheritance Module Level 5 1. IntroductionCSS defines a finite set of parameters, called properties, that direct the rendering of a document. Each property has a name (e.g., color, font-size, or border-style), a value space (e.g., <color>, <length-percentage>, [ solid | dashed | dotted | … ]), and a defined behavior on the rendering of the document. Properties values are assigned to various parts of the document via property declarations, which assign the property a value (e.g. red, 12pt, dotted) for the associated element or box. One of the fundamental design principles of CSS is cascading, 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 value for an element/property combination. In this case, a value is be found by way of inheritance or by looking at the property’s initial value. The cascading and defaulting process takes a set of declarations as input, and outputs a 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]. 1.1. Module InteractionsThis section is normative. This module replaces and extends the rules for assigning property values, cascading, and inheritance defined in [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> value type as used in this specification. For the purpose of this specification, text nodes are treated as element children of their associated element, and possess the full set of properties; since they cannot be targeted by selectors all of their computed values are assigned by defaulting. 2. Importing Style Sheets: the @import ruleThe @import rule allows users to import style rules from other style sheets. If an @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 rule, with two exceptions:
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. Any @import rules must precede all other valid at-rules and style rules in a style sheet (ignoring @charset, @supports-condition, and @layer statement rules) and must not have any other valid at-rules or style rules between it and previous @import rules, or else the @import rule is invalid. The syntax of @import is: @import [ <url> | <string> ] [ layer | layer(<layer-name>) ]? <import-conditions> ; <import-conditions> = [ supports( [ <supports-condition> | <declaration> ] ) ]? <media-query-list>? where:
The following conditional @import rule
only loads the style sheet when the UA
supports display: flex,
and only applies the style sheet on a handheld device
with a maximum viewport width of 400px.
@import url("narrow.css") supports(display: flex) handheld and (max-width: 400px);
The following layer imports load the style sheets into
the framework.component layer, and an un-named layer, respectively:
@import url("tabs.css") layer(framework.component);
@import url("override.css") layer;
If a <string> is provided, it must be interpreted as a <url> with the same value.
The following lines are equivalent in meaning
and illustrate both @import syntaxes
(one with url() and one with a bare string):
2.1. Conditional @import RulesImport conditions allow the import to be media– or feature-support–dependent. In the absence of any import conditions, the import is unconditional. (Specifying all for the <media-query-list> has the same effect.) If the import conditions do not match, the rules in the imported stylesheet do not apply, exactly as if the imported stylesheet were wrapped in @media and/or @supports blocks with the given conditions.
The following rules illustrate how @import rules can be made media-dependent:
User agents may therefore avoid fetching a conditional import as long as the import conditions do not match. Additionally, if a <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).
The following rule illustrates how an author can provide fallback rules for legacy user agents
without impacting network performance on newer user agents:
The import conditions are given by <media-query-list>, which is parsed and interpreted as a media query list, and <supports-condition>, is parsed and interpreted as a supports query. If a <declaration> is given in place of a <supports-condition>, it must be interpreted as a <supports-decl> (i.e. the extra set of parentheses is implied) and treated as a <supports-condition>.
For example, the following two lines are equivalent:
The evaluation and full syntax of the import conditions are defined by the Media Queries [MEDIAQ] and CSS Conditional Rules [CSS-CONDITIONAL-3] specifications. 2.2. Processing Stylesheet ImportsWhen 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 cascade origin of an imported style sheet is the cascade origin of the style sheet that imported it. The environment encoding of an imported style sheet is the encoding of the style sheet that imported it. [css-syntax-3] 2.3. Content-Type of CSS Style SheetsThe processing of imported style sheets depends on the actual type of the linked resource:
If the linked resource’s type is 3. Shorthand PropertiesSome properties are shorthand properties, meaning that they allow authors to specify the values of several properties with a single property. A shorthand property sets all of its longhand sub-properties, exactly as if expanded in place. When values are omitted from a shorthand form, unless otherwise defined, each “missing” sub-property is assigned its initial value.
This means that a shorthand property declaration always sets all of its sub-properties,
even those that are not explicitly set.
Carelessly used, this might result in inadvertently resetting some sub-properties.
Carefully used, a shorthand can guarantee a “blank slate”
by resetting sub-properties inadvertently cascaded from other sources.
For example, writing background: green rather than background-color: green ensures that the background color overrides any earlier declarations that might have set the background to an image with background-image.
For example, the CSS Level 1 font property
is a shorthand property for setting font-style, font-variant, font-weight, font-size, line-height, and font-family all at once.
The multiple declarations of this example:
h1 can therefore be rewritten as h1 As more font sub-properties are introduced into CSS, the shorthand declaration resets those to their initial values as well. In some cases, a shorthand might have different syntax or special keywords that don’t directly correspond to values of its sub-properties. (In such cases, the shorthand 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, it is reset to its initial value by the shorthand when unspecified, but the shorthand might not include syntax to set the sub-property to any of its other values. For example, the border shorthand resets border-image to its initial value of none, but has no syntax to set it to anything else. [css-backgrounds-3] If a shorthand is specified as one of the CSS-wide keywords [css-values-3], it sets all of its sub-properties to that keyword, including any that are reset-only sub-properties. (Note that these keywords cannot be combined with other values in a single declaration, not even in a shorthand.) Declaring a shorthand property to be !important is equivalent to declaring all of its sub-properties to be !important. 3.1. Property AliasingProperties 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.
3.2. Resetting All Properties: the all property
The all property is a shorthand that resets all CSS properties except direction and unicode-bidi. It only accepts the CSS-wide keywords. It does not reset custom properties [css-variables-1]. Note: The excepted CSS properties direction and unicode-bidi
are actually markup-level features,
and should not be set in the author’s style sheet.
(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
For example, if an author specifies all: initial 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 from the UA style sheet on block elements such as 4. Value ProcessingOnce a user agent has parsed a document and constructed a document tree, it must assign, to every element in the flat 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:
Elements that are not connected
or are not part of the document’s flattened element tree
do not participate in CSS value processing,
and do not have declared, cascaded, specified, computed, used, or actual values,
even if they potentially have style declarations assigned to them
(for example, by a 4.1. Declared ValuesEach property declaration applied to an element contributes a declared value for that property associated with the element. See Filtering Declarations for details. These values are then processed by the cascade to choose a single “winning value”. 4.1.1. Value AliasingSome property values have legacy value aliases: at parse time, the legacy syntax is converted into the new syntax, resulting in a declared value different from the parsed input. These aliases are typically used for handling legacy compatibility requirements, such as converting vendor-prefixed values to their standard equivalents. 4.2. Cascaded ValuesThe cascaded value represents the result of the cascade: it is the declared value that wins the cascade (is sorted first in the output of the cascade). If the output of the cascade is an empty list, there is no cascaded value. 4.3. Specified ValuesThe 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 through the defaulting processes, guaranteeing that a specified value exists for every property on every element. In many cases, the specified value is the cascaded value. However, if there is no cascaded value at all, the specified value is defaulted. The CSS-wide keywords are handled specially when they are the cascaded value of a property, setting the specified value as required by that keyword, see § 7.3 Explicit Defaulting. 4.4. Computed ValuesThe computed value is the result of resolving the specified value as defined in the “Computed Value” line of the property definition table, generally absolutizing it in preparation for inheritance. Note: The computed value is the value that is transferred from parent to child during inheritance.
For historical reasons,
it is not necessarily the value returned by the
A specified value can be either absolute (i.e., not relative to another value, as in red or 2mm)
or relative (i.e., relative to another value, as in auto, 2em).
Computing a relative value generally absolutizes it:
See examples (f), (g) and (h) in the table below. Note: In general, the computed value resolves the 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 exists even when the property does not apply. However, some properties may change how they determine the computed value based on whether the property applies to the element. 4.5. Used ValuesThe used value is the result of taking the computed value and completing any remaining calculations to make it the absolute theoretical value used in the formatting of the document. For example, a declaration of width: auto can’t be resolved into a length without knowing the layout of the element’s ancestors, so the computed value is auto, while the used value is an absolute length, such as 100px. [CSS2]
As another example, a If a property does not apply to this element or box type then it has no used value for that property. For example, the flex property has no used value on elements that aren’t flex items. 4.5.1. Applicable PropertiesIf a property does not apply to an element or box type—as noted in its “Applies to” line—this means it does not directly take effect on that type of box or element. Note: A property that does not apply can still have indirect formatting effects if its computed value affects the computation of other properties that do apply; and of course its computed value, which always exists, can still inherit to descendants and take effect on them.
Even though writing-mode and text-orientation do not apply to table rows
(they do not affect how the table row or its children are laid out),
setting them on such boxes
will still affect the calculation of font relative units such as ch,
and thus possibly any property that takes a <length>.
Setting text-transform on an HTML
p element
(which is display: block by default)
will have an effect,
even though text-transform only applies to inline boxes,
because the property inherits
into the paragraph’s anonymous root inline box
and applies to the text it contains.
Note: A property defined to apply to “all elements” applies to all elements and display types, but not necessarily to all pseudo-element types, since pseudo-elements often have their own specific rendering models or other restrictions. The ::before and ::after pseudo-elements, however, are defined to generate boxes almost exactly like normal elements and are therefore defined accept all properties that apply to “all elements”. See [CSS-PSEUDO-4] for more information about pseudo-elements. 4.6. Actual ValuesA 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 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 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 property does not reflect whether there is a page break or not after the element. Similarly, the actual value of orphans does not reflect how many orphan lines there is in a certain element. See examples (j) and (k) in the table below. 4.7. Examples
4.8. Per-Fragment Value ProcessingCertain CSS features can interfere with value processing on a per-fragment basis. See for example CSS Pseudo-Elements 4 § 2.1.3 Inheritance and the ::first-line Pseudo-element which alters inheritance for fragments within the ::first-line pseudo-element. In such cases, where individual fragments are given different specified values, any values that resolve based on the computed value of other properties (such as currentcolor or em units) are resolved per box fragment. Subsequent value processing proceeds as normal in each fragment. APIs that assume a singular value per box (rather than per box fragment)
must ignore the effects of non-tree-abiding pseudo-elements.
(For example, ::first-line styles have no effect on the value returned by
For example, given the following markup:
In each However, 5. FilteringIn order to find the declared values, implementations must first identify all declarations that apply to each element. A declaration applies to an element if:
The values of the declarations that apply form, for each property on each element, a list of declared values. The next section, the cascade, prioritizes these lists. 6. CascadingThe cascade takes an unordered list of declared values for a given property on a given element, sorts them by their declaration’s precedence as determined below, and outputs a single cascaded value. 6.1. Cascade Sorting OrderThe cascade sorts declarations according to the following criteria, in descending order of precedence:
The output of the cascade is a (potentially empty) sorted list of declared values for each property on each element. 6.2. Cascading OriginsEach style rule has a cascade origin, which determines where it enters the cascade. CSS defines three core origins:
Extensions to CSS define the following additional origins:
6.3. Important Declarations: the !important annotationCSS 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 marked important, which increases its weight in the cascade and inverts the order of precedence. A declaration is important if it has a !important annotation as defined by [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. All other declarations are normal (non-important). An important declaration takes precedence over a normal declaration. Author and user style sheets may contain important declarations, with user-origin important declarations overriding author-origin 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] User-agent style sheets may also contain important declarations. These override all author and user declarations.
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 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.
6.4. Cascade LayersIn the same way that cascade origins provide a balance of power between user and author styles, cascade layers provide a structured way to organize and balance concerns within a single origin. Rules within a single cascade layer cascade together, without interleaving with style rules outside the layer. Authors can create layers to represent element defaults, third-party libraries, themes, components, overrides, and other styling concerns—and are able to re-order the cascade of layers in an explicit way, without altering selectors or specificity within each layer, or relying on order of appearance to resolve conflicts across layers.
For example, the following generates an explicit reset layer,
with lower cascade precedence than any unlayered styles:
audio The unlayered declarations on the At-rules (such as @keyframes, @font-face, @page, etc.) that are defined inside cascade layers also use the layer order when resolving collisions or cascading.
For example,
authors could override the animation from a framework,
by providing keyframes with the same name in a higher-precedence layer:
In this case the override layer
has a higher cascade precedence than the framework layer,
so 6.4.1. Declaring Cascade LayersCascade layers can be declared:
Provide an attribute for assigning link or style elements to cascade layers? [w3c/csswg-drafts Issue #5853] 6.4.2. Layer Naming and NestingA cascade layer has a layer name, which is an ordered list representing each level of layer nesting, each segment of which can be named (as a CSS identifier) or anonymous. (Thus, when a layer is nested inside of another layer, this concatenates their names.) One layer is nested in another when it is declared within the scope of another layer, e.g. an @layer rule inside another @layer, a layered @import inside a layered import, or an @layer rule inside a layered import. Layer names represent the same cascade layer if they contain the same segments in the same order; however anonymous segments have unique identities for each occurrence. Note that nesting can cause multiple layers to share the same anonymous segment.
Explicit layer identifiers provide a way
to assign multiple style blocks to a single layer.
In the following example,
the contents of
headings.css and links.css
are cascaded within the same layer as the audio[controls] rule:
In this example,
the nested framework.base layer is distinct
from the top-level base layer:
The resulting layers can be represented as a tree:
or as a flat list with nested identifiers:
Syntactically, an explicit layer name is represented by the <layer-name> in @layer and @import rules, which is a period-separated list of <ident> tokens with no intervening white space: <layer-name> = <ident> [ '.' <ident> ]* The CSS-wide keywords are reserved for future use, and cause the rule to be invalid at parse time if used as an <ident> in the <layer-name>. When multiple identifiers are concatenated with a period, this is a shorthand representing those layers nested in order.
Note: A nested layer cannot “escape” its parent layer to reference layers outside itself. 6.4.2.1. Anonymous LayersWhen a @layer rule omits its <layer-name>, or an @import rule uses the layer keyword (which does not provide a <layer-name>), its layer name gains a unique anonymous segment; it therefore cannot be referenced from the outside.
Each occurrence of an anonymous layer declaration
represents a unique cascade layer,
thus:
A layer declared without a <layer-name>
does not provide any external hook for re-arranging or adding styles.
While this can be a mere convenience for brevity, it can also be used by teams as a way to force an organizing convention (all code in that layer must be defined in the same place), or by libraries wanting to merge & hide a set of internal “private” layers that they don’t want exposed to author manipulation:
6.4.3. Layer OrderingCascade layers are sorted by the order in which they first are declared, with nested layers grouped within their parent layer. Unlayered rules are sorted later than any layered rules within the same parent layer (if any).
Given the following layer rules:
The outer layers are sorted first, with any unlayered style rules added to an implicit outer layer which has higher precedence than (comes after) the explicit layers:
Within each layer, nested layers are sorted in appearance order, and style rules without further nesting are similarly added to an implicit sub-layer after the explicitly nested layers:
Layers that are defined inside of a conditional group rule do not contribute to the layer order unless the condition is true or unless the conditional group rule can evaluate differently for different elements in the document. Note: Since the layer order is global to the document, any layers defined inside an element-sensitive conditional group rule need to be accommodated when establishing the global layer order, regardless of the rule’s condition. Conditions that are global to the document, however (such as @media and @supports) can accommodate such @layer rules conditionally.
For example,
the following layer order
will depend on which media conditions match:
If the first media-query matches based on viewport dimensions, then the layout layer will come first in the layer order. If the color-scheme preference query matches, or if neither condition is true, then theme will come first in the layer order. Authors who want to avoid this behavior can establish an explicit ordering of layers in advance, and avoid defining new layers inside conditional rules. Note: Cascade layers are scoped to their origin and context, so the ordering of layers in the light DOM has no impact on the order of identically-named layers in the shadow DOM (and vice versa). Allow authors to explicitly place unlayered styles in the layer order [Issue #6323] 6.4.4. Declaring Layers Inline: the @layer ruleThe @layer rule declares a cascade layer, with the option to assign style rules. 6.4.4.1. Assigning Styles Inline: the @layer block at-ruleThe @layer block at-rule assigns its child style rules to a particular named cascade layer. This block layer-assignment syntax is: @layer <layer-name>? { <rule-list> } Such @layer block rules have the same restrictions and processing as a conditional group rule [CSS-CONDITIONAL-3] with a true condition.
For example, @layer and @media can be mixed:
Note: @layer block at-rules cannot be interleaved with @import rules. 6.4.4.2. Declaring Without Styles: the @layer statement at-ruleThe @layer rule can also be used to define new layers without assigning any style rules, by providing only the layer name: @layer <layer-name>#; Such empty @layer rules are allowed before @import and @namespace rules (after the @charset rule, if any) as well as everywhere @layer block at-rules are allowed. Note: No @layer rules are allowed between @import and @namespace rules. Any @layer rule that comes after an @import or @namespace rule will cause any subsequent @import or @namespace rules to be ignored. Unlike the block syntax, multiple comma-separated layer names can be provided in this syntax, declaring each of the layers in the order specified. Note: Since layer ordering is defined by first occurrence of the layer name (see § 6.4.3 Layer Ordering), this rule allows a page to declare the order of its layers up front, so that their order is apparent without having to read the entire style sheet. It also allows inline layers to be interleaved with imported layers, which is not possible with the block syntax.
The statement syntax
allows establishing a layer order in advance,
regardless of the order in which style rules are added to each layer.
It can be helpful to establish that layer order in advance,
before any @import rules.
In this example,
the imported
theme.css style rules will override
any rules added in the later default block
since the order of layers has already been established:
It’s also possible to have @import rules help establish the order, by placing them between @layer rules. This example will have the same result:
However, @import and @namespace rules must be consecutive, without any intervening rules. The following is invalid:
6.5. Precedence of Non-CSS Presentational HintsThe UA may choose to honor presentational hints in a source document’s markup,
for example the A document language may define whether such a presentational hint enters the cascade as UA-origin or author-origin; if so, the UA must behave accordingly. For example, [SVG11] maps its presentation attributes into the author origin. Note: Presentational hints entering the cascade as UA-origin rules can be overridden by author-origin or user-origin styles. Presentational hints entering the cascade as author presentational hint origin rules can be overridden by author-origin styles, but not by non-important user-origin styles. Host languages should choose the appropriate origin for presentational hints with these considerations in mind. 7. DefaultingWhen the cascade does not result in a value, the specified value must be found some other way. Inherited properties draw their defaults from their parent element through inheritance; all other properties take their initial value. Authors can explicitly request inheritance or initialization via the inherit and initial keywords. 7.1. Initial ValuesEach property has an initial value, defined in the property’s definition table. If the property is not an inherited property, and the cascade does not result in a value, then the specified value of the property is its initial value. 7.2. InheritanceInheritance propagates property values from parent elements to their children. The inherited value of a property on an element is the computed value of the property on the element’s parent element. For the root element, which has no parent element, the inherited value is the initial value of the property. For a [DOM] tree with shadows,
inheritance operates on the flattened element tree.
This means that slotted elements inherit from the 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 keyword. Note: Inheritance follows the document tree and is not intercepted by anonymous boxes, or otherwise affected by manipulations of the box tree. 7.3. Explicit DefaultingSeveral 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 [css-values-3], all CSS properties can accept these values. The keywords revert, revert-layer, and revert-rule are cascade-dependent keywords; some contexts may restrict their use while allowing the other CSS-wide keywords. 7.3.1. Resetting a Property: the initial keywordThe initial CSS-wide keyword represents the value defined as the property’s initial value. If the cascaded value of a property is the initial keyword, the property’s specified value is its initial value. 7.3.2. Explicit Inheritance: the inherit keywordThe inherit CSS-wide keyword represents the property’s computed value on the parent element. If the cascaded value of a property is the inherit keyword, the property’s specified and computed values are the inherited value. 7.3.3. Erasing All Declarations: the unset keywordThe unset CSS-wide keyword acts as either inherit or initial, depending on whether the property is inherited or not. If the cascaded value of a property is the unset keyword, then if it is an inherited property, this is treated as inherit, and if it is not, this is treated as initial. This keyword effectively erases all declared values occurring earlier in the cascade, correctly inheriting or not as appropriate for the property (or all longhands of a shorthand). 7.3.4. Rolling Back Cascade Origins: the revert keywordThe revert CSS-wide keyword rolls back the cascade to the cascaded value of the earlier origin. If the cascaded value of a property is the revert keyword, the behavior depends on the cascade origin to which the declaration belongs:
Note: Effectively the revert keyword is substituted with the value from the earlier cascade origin. Thus, reverting a shorthand property reverts all its longhands; reverting any property alias of a property reverts all of them; reverting one of the paired properties in a logical property group also reverts the other one; etc. 7.3.5. Rolling Back Cascade Layers: the revert-layer keywordThe revert-layer CSS-wide keyword rolls back the cascade similar to revert, except it works by cascade layer rather than by cascade origin. If the cascaded value of a property is the revert-layer keyword, the cascaded value is rolled back to the earlier layer, so that the specified value is calculated as if no rules were specified in the current cascade layer—or between its normal and important levels in the cascade—for this property on this element. For revert-layer in important element-attached styles, however, it only reverts the element-attached styles and the intervening animation origin, and not any of the intervening author-origin important rules.
For example,
applying revert-layer to the height in layer
two,
reverts the height property to the value
defined in layer one,
yielding a height of 100px.
Note that since height and block-size are
paired properties in a logical property group,
the following layer
Note: If there are no lower-precedence declarations in the same cascade origin as the revert-layer value, the cascaded value will roll back to the previous origin. Note: The animation origin is not collapsed with the author origin for this purpose as it is for revert, and thus effectively forms its own cascade layer. 7.3.6. Rolling Back Rules: the revert-rule keywordThe revert-rule CSS-wide keyword rolls back the cascade similar to revert and revert-layer, except it works by style rule rather than cascade origin or cascade layer. If the cascaded value of a property is the revert-rule keyword, the cascaded value is rolled back such that the specified value is calculated as if the current style rule had not been present at all.
The revert-rule keyword can be combined with if()
to conditionally ignore a declaration:
div Given an element The revert-rule keyword behaves like revert-layer in the animation origin. 8. Layer APIs8.1.
The
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |