Cascading Style Sheets, level 2 CSS2revision 1
CSS 2.1 Specification
W3C Recommendation 12-May-1998Working Draft 28 January 2003
- This version:
-
http://www.w3.org/TR/1998/REC-CSS2-19980512http://www.w3.org/TR/2003/WD-CSS21-20030128
- Latest version:
-
http://www.w3.org/TR/REC-CSS2http://www.w3.org/TR/CSS21
- Previous version:
-
http://www.w3.org/TR/1998/PR-CSS2-19980324http://www.w3.org/TR/2002/WD-CSS21-20020802
- Editors:
-
Bert Bos
< bbos@w3.org ><bert @w3.org>
-
Tantek Çelik
<tantekc @microsoft.com>
-
Ian Hickson
<ian @hixie.ch>
-
Håkon Wium Lie
< howcome@w3.org > Chris Lilley < chris@w3.org > Ian Jacobs < ij@w3.org ><howcome @opera.com>
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.
Copyright © 2003 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability,
trademark,
document
use and software
licensing rules apply.
Abstract
This specification defines Cascading Style Sheets, level 2 (CSS2). CSS2level 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, spacing, and aural
cues) to structured documents (e.g., HTML documents and XML
applications). By separating the presentation style of documents from
the content of documents, CSS2CSS 2.1 simplifies Web authoring and
site maintenance.
CSS 2.1 builds on CSS2 [CSS2] which builds on CSS1 (see[CSS1] ) and, with very few exceptions, all valid CSS1 style sheets are valid CSS2 style sheets. CSS2.
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. This specificationIt also supports
content positioning, downloadable fonts,table layout, features for internationalization, automatic counters and numbering,internationalization
and some properties related to user interface.
StatusCSS 2.1 corrects a few errors in CSS2 (the most important
being a new definition of this document This document has been reviewed by W3C Members and other interested partiesthe height/width of absolutely positioned
elements, more influence for HTML's "style" attribute and has been endorsed bya new
calculation of the Director as'clip' property).
CSS 2.1 corrects a W3C Recommendation. It isfew errors in CSS2 (the most important
being a stable documentnew definition of the height/width of absolutely positioned
elements, more influence for HTML's "style" attribute and may be used as reference material or cited asa normative reference from another document. W3C's role in makingnew
calculation of the Recommendation'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 were implemented interoperably at the date of publication.
Status of this document
This document is to draw attention toproduced by the CSS working group (part of
the Style Activity, see summary).
The CSS features takes placeWG is aware that this draft does not yet address all the
comments raised on www-style@w3.org . Available formatsthe CSS2 specification is available inprevious draft. The following formats: HTML: http://www.w3.org/TR/1998/REC-CSS2-19980512 a plain text file: http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.txt , HTML asnext draft should follow in
a gzip'ed tar file: http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.tgz , HTML as a zip file (thisfew weeks and is expected to be the final one.
The (archived)
public mailing list www-style@w3.org (see instructions) is preferred
for discussion of this and other drafts in the Style area. When
commenting on this draft, please put the text "CSS21" in the subject,
preferably like this: "[CSS21] <summary of comment>"
For this specification to exit the CR stage, the following
conditions shall be met:
There must be at least two interoperable implementations
implementing 'all' the features. An implementation can implement a
'.zip' filesuperset of the features and claim conformance to the profile. For
the purposes of this criterion, we define the following terms:
- feature
-
An individual test case in the test suite.
- interoperable
-
passing the respective test case(s) in the CSS test suite, or,
if the implementation is not a web browser, an '.exe'): http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.zip , as well asequivalent test.
Every relevant test in the test suite should have an equivalent
test created if such a gzip'ed PostScript file: http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.ps.gz , andUA is to be used to claim interoperability.
In addition if such a PDF file: http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.pdf .UA is to be used to claim interoperability,
then there must one or more additional UAs which can also pass
those equivalent tests in casethe same way for the purpose of
a discrepancy betweeninteroperability. The equivalent tests must be made publicly
available for the various formspurposes of peer review.
- implementation
-
a user agent which:
- implements the
specification, http://www.w3.org/TR/1998/REC-CSS2-19980512feature.
- is
considered the definitive version.available languages(i.e. publicly downloadable or available
through some other public point of sale mechanism). This is the
English version"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 sixth months of the CR period must have elapsed.
This specificationis to ensure that enough time is given for any remaining major
errors to be caught.
Features may/will be dropped if two or more interoperable
implementations are not found by the only normative version. However,end of the CR period.
Features may/will also be dropped if adequate/sufficient (by
judgment of CSS WG) tests have not been produced for translations in other languages see http://www.w3.org/Style/css2-updates/translations.html . Erratathose
feature(s) by the listend of known errors inthe CR period.
This specificationis availablea public W3C Working Draft for review by W3C Members and
other interested parties. It is a draft document and may be updated,
replaced, or obsoleted by other documents at http://www.w3.org/Style/css2-updates/REC-CSS2-19980512-errata.html . Please report errorsany time. It is
inappropriate to use W3C Working Drafts as reference material or to
cite them as other than "work in this documentprogress."
Patent disclosures relevant to css2-editors@w3.orgCSS may be found on the Working
Group's public patent disclosure
page.
A list of current W3C Recommendations and other technical documents
can be found at http://www.w3.org/TR.
- 1 About the
CSS2CSS 2.1 Specification
- 2 Introduction to
CSS2CSS 2.1
- 3 Conformance: Requirements and Recommendations
- 4
CSS2Syntax 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-bottom', 'border-right', 'border-left', and 'border'
- 8.5.5 The border model for inline elements
- 9 Visual formatting model
- 10 Visual formatting model details
- 10.1 Definition of "containing block"
- 10.2 Content width: the 'width' property
- 10.3 Computing 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 Computing heights and margins
- 10.6.1 Inline, non-replaced elements
- 10.6.2
Inline,Inline replaced elements block-level,elements, block-level replaced elements in normal flow, 'inline-block' replaced elements in normal flow and floating,floating replaced elements
- 10.6.3
Block-level,Block-level and 'inline-block', non-replaced elements in normal flow,flow and floating, non-replaced elements
- 10.6.4 Absolutely positioned, non-replaced elements
- 10.6.5 Absolutely positioned, replaced elements
- 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
-
15.2.6 Generic font families serif sans-serif cursive fantasy monospace 15.3 Font selection 15.3.1 Font Descriptions and @font-face 15.3.2 Descriptors for Selecting a Font: 'font-family' , 'font-style' , 'font-variant' , 'font-weight' , 'font-stretch' and 'font-size' 15.3.3 Descriptors for Font Data Qualification: 'unicode-range' 15.3.4 Descriptor for Numeric Values: 'units-per-em' 15.3.5 Descriptor for Referencing: 'src' 15.3.6 Descriptors for Matching: 'panose-1' , 'stemv' , 'stemh' , 'slope' , 'cap-height' , 'x-height' , 'ascent' , and 'descent' 15.3.7 Descriptors for Synthesis: 'widths' , 'bbox' and 'definition-src' 15.3.8 Descriptors for Alignment: 'baseline' , 'centerline' , 'mathline' , and 'topline' 15.3.9 Examples 15.4 Font Characteristics 15.4.1 Introducing Font Characteristics 15.4.2 Full font name 15.4.3 Coordinate units on the em square 15.4.4 Central Baseline 15.4.5 Font Encoding 15.4.6 Font family name 15.4.7 Glyph widths 15.4.8 Horizontal stem width 15.4.9 Height of uppercase glyphs 15.4.10 Height of lowercase glyphs 15.4.11 Lower Baseline 15.4.12 Mathematical Baseline 15.4.13 Maximal bounding box 15.4.14 Maximum unaccented height 15.4.15 Maximum unaccented depth 15.4.16 Panose-1 number 15.4.17 Range of ISO 10646 characters 15.4.18 Top Baseline 15.4.19 Vertical stem width 15.4.20 Vertical stroke angle 15.5 Font matching algorithm 15.5.1 Mapping font weight values to font names 15.5.2 Examples of font matching16 Text
- 17 Tables
-
17.7 Audio rendering of tables 17.7.1 Speaking headers: the 'speak-header' property18 User interface
-
19Appendix A. Aural style sheets
- Appendix B.
Changes from CSS1Bibliography
- Appendix C.
Implementation and performance notes for fontsChanges
- C.1
Glossary of font termsAdditional property values
- C.2
Font retrieval C.3 MeaningChanges
- 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
grammar'visibility' property
- C.3.24 12.6.2 Lists
- C.3.25 Section 15.2.6
- C.3.26 Section 15.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
CSS2 D.1 Grammartable 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
-
D.3 Comparison of tokenization inC.4 Clarifications
-
E.1 Normative references E.2 Informative referencesAppendix F.D. A sample style sheet for HTML 4.0
- Appendix E. Property index
- Appendix
G. DescriptorF. Index
- Appendix
H. Index Copyright © 1998 W3C ( MIT , INRIA , Keio ), All Rights Reserved. next contents properties index G. Grammar of CSS 2.1