<wood length="5"/> <metal length="19"/> <wood length="4"/> </stock> stock::before { display: block; content: "To scale, the lengths of materials in stock are:"; } stock > * { display: block; width: attr(length em); /* default 0 */ height: 1em; border: solid thin; margin: 0.5em; } wood { background: orange url(wood.png); } metal { background: silver url(metal.png); }
All of the following examples are invalid and would cause a parse-time error, and thus cause the relevant declaration—in this case all of them—to be ignored:
content: attr(title color); /* 'content' doesn't accept colors */ content: attr(end-of-quote string, inherit) close-quote; /* the 'inherit' value is not allowed there, since the result would be 'inherit close-quote', which is invalid. */ margin: attr(vertical length) attr(horizontal deg); /* deg units are not valid at that point */ color: attr(color); /* 'color' doesn't accept strings */
The ‘attr()
’ expression cannot currently fall back onto another attribute. Future versions of CSS may extend ‘attr()
’ in this direction.
about:invalid
URL scheme This sections defines and registers the about:invalid
URI, in accordance with the registration procedure defined in the about: uri scheme RFC draft.
The official record of this registration can be found at http://www.iana.org/assignments/about-uri-tokens/about-uri-tokens.xml.
Registered Token | invalid |
---|---|
Intended Usage | The |
Contact/Change controller | CSS WG <www-style@w3.org> (on behalf of W3C) |
Specification | CSS Values and Units Module Level 3 |
Comments and suggestions from Giovanni Campagna, Christoph Päper, Keith Rarick, Alex Mogilevsky, Ian Hickson, David Baron, Edward Welbourne, Boris Zbarsky, Björn Höhrmann and Michael Day improved this module.
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]
Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example"
, like this:
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.
Conformance to CSS Values and Units Level 3 is defined for three conformance classes:
A style sheet is conformant to CSS Values and Units Level 3 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 CSS Values and Units Level 3 if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined CSS Values and Units Level 3 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 CSS Values and Units Level 3 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.
So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) 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 component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.
To avoid clashes with future CSS features, the CSS2.1 specification reserves a prefixed syntax for proprietary and experimental extensions to CSS.
Prior to a specification reaching the Candidate Recommendation stage in the W3C process, all implementations of a CSS feature are considered experimental. The CSS Working Group recommends that implementations use a vendor-prefixed syntax for such features, including those in W3C Working Drafts. This avoids incompatibilities with future changes in the draft.
Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec.
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 http://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.
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:
The specification will remain Candidate Recommendation for at least six months.
Changes since the 8 March 2012 Last Call Working Draft include many clarifications as well as the following:
cycle()
’ to ‘toggle()
’. calc()
’ can now accept and return <integer> types. calc()
’ may now be nested (to simplify handling of macros and variables). attr()
’. attr()
’. vmax
’ unit. A disposition of last-call comments is available.
default
’, 3.1.1. inherit
’, 3.1.1. initial
’, 3.1.1.