Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification

W3C

Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification

W3C Candidate Recommendation 08 September 2009

This version:
http://www.w3.org/TR/2009/CR-CSS2-20090908
Latest version:
http://www.w3.org/TR/CSS2
Previous versions:
http://www.w3.org/TR/2009/CR-CSS2-20090423
http://www.w3.org/TR/2008/REC-CSS2-20080411/
Editors:
Bert Bos <>
Tantek Çelik <>
Ian Hickson <>
Håkon Wium Lie <>

Please refer to the errata for this document.

This document is also available in these non-normative formats: plain text, gzip'ed tar file, zip file, gzip'ed PostScript, PDF. See also translations.


Abstract

This specification defines Cascading Style Sheets, level 2 revision 1 (CSS 2.1). CSS 2.1 is a style sheet language that allows authors and users to attach style (e.g., fonts and spacing) to structured documents (e.g., HTML documents and XML applications). By separating the presentation style of documents from the content of documents, CSS 2.1 simplifies Web authoring and site maintenance.

CSS 2.1 builds on CSS2 [CSS2] which builds on CSS1 [CSS1]. It supports media-specific style sheets so that authors may tailor the presentation of their documents to visual browsers, aural devices, printers, braille devices, handheld devices, etc. It also supports content positioning, table layout, features for internationalization and some properties related to user interface.

CSS 2.1 corrects a few errors in CSS2 (the most important being a new definition of the height/width of absolutely positioned elements, more influence for HTML's "style" attribute and a new calculation of the 'clip' property), and adds a few highly requested features which have already been widely implemented. But most of all CSS 2.1 represents a "snapshot" of CSS usage: it consists of all CSS features that are implemented interoperably at the date of publication of the Recommendation.

CSS 2.1 is derived from and is intended to replace CSS2. Some parts of CSS2 are unchanged in CSS 2.1, some parts have been altered, and some parts removed. The removed portions may be used in a future CSS3 specification. Future specs should refer to CSS 2.1 (unless they need features from CSS2 which have been dropped in CSS 2.1, and then they should only reference CSS2 for those features, or preferably reference such feature(s) in the respective CSS3 Module that includes those feature(s)).

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 http://www.w3.org/TR/.

This is a W3C Candidate Recommendation, which means the specification has been widely reviewed and W3C recommends that it be implemented. It will remain Candidate Recommendation at least until 23 October 2009. A test suite and an implementations report will be provided before the document becomes a Proposed Recommendation.

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.

The (archived) public mailing list www-style@w3.org (see instructions) is preferred for discussion of this specification. When sending e-mail, please put the text “[CSS21]” in the subject, preferably like this: “[CSS21] …summary of comment…

This document incorporates errata resulting from implementation experience since the previous publication. Some of the corrections remove ambiguities or change the behavior in edge cases, and therefore it is expected that another Working Draft will (briefly) precede the Proposed Recommendation, in order to invite more review.

This document was produced by the CSS Working Group (part of the Style Activity).

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures 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) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Candidate Recommendation Exit Criteria

For this specification to exit the CR stage, the following conditions must be met:

  1. There must be at least two interoperable implementations for every feature. For the purposes of this criterion, we define the following terms:

    feature

    A section or subsection of the specification.

    interoperable

    passing the respective test cases in the test suite, or, if the implementation is not a web browser, equivalent tests. Every relevant test in the test suite should have an equivalent test created if such a 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 feature.
    2. is available (i.e., publicly downloadable or available through some other public point of sale mechanism). This is the "show me" requirement.
    3. is shipping (i.e., development, private or unofficial versions are insufficient).
    4. is not experimental (i.e., is intended for a wide audience and could be used on a daily basis).
  2. A minimum of six months of the CR period must have elapsed. This is to ensure that enough time is given for any remaining major errors to be caught.

  3. The CR period will be extended if implementations are slow to appear.

  4. Features that were not in CSS1 will be dropped (thus reducing the list of "all" features mentioned above) if two or more interoperable implementations of those features are not found by the end of the CR period.

  5. Features will also be dropped if sufficient and adequate tests (by judgment of the working group) have not been produced for those features by the end of the CR period.

Features at risk

The working group has identified the following features as being currently poorly implemented by UAs. They are therefore most at risk of being removed from CSS 2.1 when exiting CR. (Any changes of this nature will still result in the specification being returned to last call.) Implementors are urged to implement these features, or correct bugs in their implementations, if they wish to see these features remain in this specification.

New 'list-style-type' values

Implementors are advised to look at CSS3 Lists instead, where these and many other new values not found in CSS1 are defined in detail. [CSS3LIST]

Support for multiple ID attributes for the ID selector

Because implementations are not expected to support multiple IDs per element soon, this feature may be made informative. The W3C Selectors specification will continue to have this feature normatively. (Section 5.9.)

Automatic table layout algorithm

The input to the suggested (non-normative) automatic layout algorithm for tables is restricted to (1) the containing block width and (2) the content and properties of the table and its children. This restriction may be lifted.

Quotes

The 'quotes' property and the 'open-quote', 'close-quote', 'no-open-quote' and 'no-close-quote' keywords may be dropped.

BODY element in XHTML

The effect of 'overflow' and 'background' is different on BODY elements in HTML than on other elements. It may be that the exceptional handling of BODY in HTML is extended to BODY in XHTML1.

Quick Table of Contents

Full Table of Contents