This document shows the specification for Cascading Style Sheets
level 2 [CSS21] as it would look with proposed errata included.
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 simplifies Web authoring and
CSS level 2 extends CSS level 1 and is itself extended by
various other CSS specifications, called “CSS modules.”
(For an overview of the various specifications that make up CSS, see
the separate Note titled “CSS Snapshot” [CSS].)
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
This document is a preview of how the next revision of the CSS
level 2 Recommendation might look. It is not a
specification itself, but meant for information and to collect
feedback, before a possible revision of the Recommendation. This
document is not expected to progress to Recommendation itself. It may,
however, be updated by another Note.
All changes relative to the CSS 2.1 Recommendation are listed
in appendix C.
This is a copy of the editors' draft for the Note. It
is not an official W3C Note.
This document was produced by the CSS Working Group (part
of the Style Activity).
public mailing list firstname.lastname@example.org (see instructions) is preferred
for discussion of this specification. When sending e-mail, please put
the text “css2-testing” in the subject, preferably like
this: “[css2-testing] …summary of
Issues can also be posted via
the GitHub Web site.
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
Claim(s) must disclose the information in accordance
with section 6 of
the W3C Patent Policy.
This document is governed by the 1 September 2015 W3C
Full Table of Contents
- 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 bidirectional 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
- Appendix D. Default style sheet for HTML 4
- Appendix E. Elaborate description of Stacking Contexts
- Appendix F. Full property table
- Appendix G. Grammar of CSS 2.1
- Appendix I. Index