W3C liability , trademark , document use and software licensing rules apply.Abstract
This specification defines Cascading Style Sheets, level 2
revision 1 (CSS 2.1). CSS 2.1 is a style sheet language
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
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.
Status of this document
This section describes the status of this document at the time
of its publication. Other documents may supersede it. 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 1 September 2004. Publication as a Candidate Recommendation does not imply endorsement by The W3C Membership. It is inappropriate to cite this document as other than work in progress. A test suite and a report on implementations will be provided before the document becomes a Proposed Recommendation.
public mailing list firstname.lastname@example.org (see instructions) is preferred for discussion of
this and other specifications in the Style area. When commenting on
this document, please put the text "CSS21" in the subject, preferably
like this: "[CSS21] <summary of comment>"
This document is produced by the CSS
working group (part of the Style Activity,
CSS may be found on
the Working Group's public
Patent disclosure page.
Candidate Recommendation Exit Criteria
For this specification to exit the CR stage, the following
conditions must be met:
There must be at least two interoperable implementations
for every feature. For the purposes of this criterion,
we define the following terms:
A section or subsection of the specification.
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.
a user agent which:
- implements the feature.
- is available (i.e. publicly downloadable or available
through some other public point of sale mechanism). This is the
"show me" requirement.
- is shipping (i.e. development, private or unofficial
versions are insufficient).
- is not experimental (i.e. is intended for a wide audience
and could be used on a daily basis).
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.
The CR period will be extended if implementations are slow to
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.
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.
- 1 About the CSS 2.1 Specification
- 2 Introduction to CSS 2.1
- 3 Conformance: Requirements and Recommendations
- 4 Syntax and basic data types
- 5 Selectors
- 6 Assigning property values, Cascading, and Inheritance
- 7 Media types
- 8 Box model
- 8.1 Box dimensions
- 8.2 Example of margins, padding, and borders
- 8.3 Margin properties: 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', and 'margin'
- 8.4 Padding properties: 'padding-top', 'padding-right', 'padding-bottom', 'padding-left', and 'padding'
- 8.5 Border properties
- 8.5.1 Border width: 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', and 'border-width'
- 8.5.2 Border color: 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', and 'border-color'
- 8.5.3 Border style: 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style', and 'border-style'
- 8.5.4 Border shorthand properties: 'border-top', 'border-right', 'border-bottom', 'border-left', and 'border'
- 8.6 The box model for inline elements in bidirection context
- 9 Visual formatting model
- 10 Visual formatting model details
- 10.1 Definition of "containing block"
- 10.2 Content width: the 'width' property
- 10.3 Calculating widths and margins
- 10.3.1 Inline, non-replaced elements
- 10.3.2 Inline, replaced elements
- 10.3.3 Block-level, non-replaced elements in normal flow
- 10.3.4 Block-level, replaced elements in normal flow
- 10.3.5 Floating, non-replaced elements
- 10.3.6 Floating, replaced elements
- 10.3.7 Absolutely positioned, non-replaced elements
- 10.3.8 Absolutely positioned, replaced elements
- 10.3.9 'Inline-block', non-replaced elements in normal flow
- 10.3.10 'Inline-block', replaced elements in normal flow
- 10.4 Minimum and maximum widths: 'min-width' and 'max-width'
- 10.5 Content height: the 'height' property
- 10.6 Calculating heights and margins
- 10.7 Minimum and maximum heights: 'min-height' and 'max-height'
- 10.8 Line height calculations: the 'line-height' and 'vertical-align' properties
- 11 Visual effects
- 12 Generated content, automatic numbering, and lists
- 13 Paged media
- 14 Colors and Backgrounds
- 15 Fonts
- 16 Text
- 17 Tables
- 18 User interface
- Appendix A. Aural style sheets
- Appendix B. Bibliography
- Appendix C. Changes
- C.1 Additional property values
- C.2 Changes
- C.3 Errors
- C.3.1 Shorthand properties
- C.3.2 Section 4.1.1 (and G2)
- C.3.3 4.1.3 Characters and case
- C.3.4 Section 4.3 (Double sign problem)
- C.3.5 Section 4.3.2 Lengths
- C.3.6 Section 4.3.6
- C.3.7 5.10 Pseudo-elements and pseudo-classes
- C.3.8 8.2 Example of margins, padding, and borders
- C.3.9 Section 8.5.2 Border color: 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', and 'border-color'
- C.3.10 Section 8.4 Padding properties
- C.3.11 8.5.3 Border style
- C.3.12 Section 8.5.4 Border shorthand properties: 'border-top', 'border-bottom', 'border-right', 'border-left', and 'border'
- C.3.13 8.5.4 Border shorthand properties: 'border-top', 'border-bottom', 'border-right', 'border-left', and 'border'
- C.3.14 Section 9.3.1
- C.3.15 Section 9.3.2
- C.3.16 Section 9.4.3
- C.3.17 Section 9.7 Relationships between 'display', 'position', and 'float'
- C.3.18 Section 10.3.2 Inline, replaced elements (and 10.3.4, 10.3.6, and 10.3.8)
- C.3.19 Section 10.3.3
- C.3.20 Section 10.6.2 Inline, replaced elements ... (and 10.6.5)
- C.3.21 Section 10.6.3
- C.3.22 Section 11.1.1
- C.3.23 11.2 Visibility: the 'visibility' property
- C.3.24 12.6.2 Lists
- C.3.25 Section
15.2.6 C.3.26 Section15.5
C.3.27 Section 16.6 Whitespace: the 'white-space' property
C.3.28 Section 17.2 The CSS table model
C.3.29 17.2.1 Anonymous table objects
C.3.30 17.5 Visual layout of table contents
C.3.31 17.5 Visual layout of table contents
C.3.32 Section 17.5.1 Table layers and transparency
C.3.33 Section 17.6.1 The separated borders model
C.3.34 Appendix D.2 Lexical scanner
- C.4 Clarifications
- Appendix D. Default style sheet for HTML 4.0
- Appendix E. Elaborate description of Stacking Contexts
- Appendix F. Full property table
- Appendix G. Grammar of CSS 2.1
- Appendix I. Index