W3C WD-css2-19980128

Cascading Style Sheets, level 2

W3C Working Draft 28-Jan-1998
This version:
Latest version:
Previous version:
Bert Bos <bbos@w3.org>
Håkon Wium Lie <howcome@w3.org>
Chris Lilley <chris@w3.org>
Ian Jacobs <ij@w3.org>


This specification defines Cascading Style Sheet, level 2 (CSS2). CSS2 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 and XML). The CSS2 language is human readable and writable, and expresses style in common desktop publishing terminology.

CSS2 builds on [CSS1], specified in http://www.w3.org/TR/REC-CSS1-961217. All valid CSS1 style sheets are valid CSS2 style sheets.

Status of this document

This is a 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 any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress". This is work in progress and does not imply endorsement by, or the consensus of, either W3C or members of the CSS working group.

This document has been produced as part of the W3C Style Activity, and is intended as a draft of a proposed recommendation for CSS2.

If you did not get this document directly from the W3C website you may want to check whether you have the latest version of this document by looking at the list of W3C technical reports at <http://www.w3.org/TR/>.

Available formats

The CSS2 specification is also available in the following formats:

a plain text file:
HTML as a gzip'ed tar file:
HTML as a zip file (this is a '.zip' file not an '.exe'):
as well as a postscript file:
and a PDF file:

In case of a discrepancy between electronic and printed forms of the specification, the electronic version is considered the definitive version.

Available languages

The English version of this specification is the only normative version. However, for translations in other languages see http://www.w3.org/TR/1998/WD-css2-19980128/translations.html.


Please send detailed comments on this document to the editors. We cannot guarantee a personal response but we will try when it is appropriate. Public discussion on CSS features takes place on www-style@w3.org and messages are archived at http://lists.w3.org/Archives/Public/www-style/.

Quick Table of Contents

  1. About the CSS2 Specification
  2. Introduction to CSS2
  3. Conformance: Requirements and Recommendations
  4. CSS2 syntax and basic data types
  5. Selectors
  6. Assigning property values, Cascading, and Inheritance
  7. Media types
  8. Visual rendering model
  9. Visual rendering model details
  10. Visual effects
  11. Generated content and automatic numbering
  12. Paged media
  13. Colors and Backgrounds
  14. Fonts
  15. Text
  16. Lists
  17. Tables
  18. User interface
  19. Aural style sheets
  1. Appendix A: A sample style sheet for HTML 4.0
  2. Appendix B: Changes from CSS1
  3. Appendix C: Implementation and performance notes
  4. Appendix D: The grammar of CSS2

Full Table of Contents

  1. About the CSS2 Specification
    1. Reading the specification
    2. How the specification is organized
    3. Conventions
      1. Document language elements and attributes
      2. CSS property definitions
        1. Shorthand properties
      3. Notes and examples
    4. Acknowledgments
    5. Copyright Notice
  2. Introduction to CSS2
    1. A brief CSS2 tutorial for HTML
    2. A brief CSS2 tutorial for XML
    3. The CSS2 processing model
      1. The canvas
      2. CSS2 addressing model
    4. CSS design principles
  3. Conformance: Requirements and Recommendations
    1. Definitions
    2. Conformance
    3. Error conditions
  4. CSS2 syntax and basic data types
    1. Syntax
      1. Tokenization
      2. Characters and case
      3. Statements
      4. At-rules
      5. Blocks
      6. Rule sets, declaration blocks, and selectors
      7. Declarations and properties
    2. Rules for handling parsing errors
    3. Values
      1. Integers and real numbers
      2. Lengths
      3. Percentages
      4. URIs
      5. Colors
      6. Angles
      7. Times
      8. Frequencies
      9. Strings
    4. CSS embedded in HTML
    5. CSS as a stand-alone file
    6. Character escapes in CSS
  5. Selectors
    1. Pattern matching
    2. Universal selector
    3. Type selectors
    4. Descendant selectors
    5. Child selectors
      1. :first-child pseudo-class
    6. Adjacent selectors
    7. Attribute selectors
      1. Matching attributes and attribute values
        1. Reusing the value of an attribute
      2. The "class" attribute in HTML
    8. ID selectors
    9. Grouping
    10. Pseudo-elements and pseudo-classes
      1. The :first-line pseudo-element
      2. The :first-letter pseudo-element
      3. The :before and :after pseudo-elements
      4. Pseudo-elements with descendant selectors
      5. The Anchor pseudo-classes: :link, :visited, :hover, and :active
      6. Combining pseudo-elements with attribute selectors
  6. Assigning property values, Cascading, and Inheritance
    1. Specified, computed, and absolute values
      1. Specified values
      2. Computed values
      3. Actual values
    2. Inheritance
      1. The inherit value
    3. The cascade
      1. Cascading order
      2. 'Important' rules
      3. Cascading order in HTML
      4. Precedence of non-CSS presentational hints
  7. Media types
    1. Introduction to media types
    2. Specifying media-dependent style sheets
      1. The @media rule
      2. The media-dependent @import rule
    3. Recognized media types
      1. Media groups
  8. Visual rendering model
    1. Introduction to the visual rendering model
      1. The viewport
    2. The box model
      1. Controlling box generation: the 'display' property
        1. Compact and run-in boxes
      2. Box dimensions
      3. Example of margins, padding, and borders
    3. Positioning schemes
      1. Choosing a positioning scheme: 'position' property
      2. Box offsets: 'top', 'right', 'bottom', 'left'
    4. Normal flow
      1. Anonymous boxes
      2. Block formatting context
      3. Inline formatting context
      4. Direction of inline flow: the 'direction' property
      5. Relative positioning
    5. Floats: the 'float' and 'clear' properties
      1. Controlling flow next to floats
    6. Absolute positioning
      1. Fixed positioning
    7. Relationships between 'display', 'position', and 'float'
    8. Comparison of normal, relative, floating, absolute positioning
      1. Normal flow
      2. Relative positioning
      3. Floating a box
      4. Absolute positioning
    9. Z-order: Layered presentation
      1. Specifying the stack level: the 'z-index' property
  9. Visual rendering model details
    1. Margin, border, and padding properties
      1. Margin properties: 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', and 'margin'
      2. Padding properties: 'padding-top', 'padding-right', 'padding-bottom', 'padding-left', and 'padding'
      3. Border properties
        1. Border width: 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', and 'border-width'
        2. Border color: 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', and 'border-color'
        3. Border style: 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style', and 'border-style'
        4. Border shorthand properties: 'border-top', 'border-bottom', 'border-right', 'border-left', and 'border'
    2. Containing blocks
    3. Box width calculations
      1. Content width: the 'width' property
      2. Widths of boxes in the normal flow and floated boxes
        1. Determining the content width
        2. Computing margin widths
      3. Width of absolutely positioned elements
      4. Minimum and maximum widths: 'min-width' and 'max-width'
    4. Box height calculations
      1. Content height: the 'height' property
      2. Determining the content height
      3. Height of absolutely positioned elements
      4. Minimum and maximum heights: 'min-height' and 'max-height'
    5. Collapsing margins
    6. Line height calculations: the 'line-height' and 'vertical-align' properties
      1. Leading and half-leading
    7. Floating constraints
  10. Visual effects
    1. Overflow and clipping
      1. Overflow: the 'overflow' property
      2. Clipping: the 'clip' property
    2. Visibility: the 'visibility' property
  11. Generated content and automatic numbering
    1. The :before and :after pseudo elements and the 'content' property
    2. Automatic counters and numbering
  12. Paged media
    1. Introduction to paged media
    2. Page boxes: the @page rule
      1. Page margins
      2. Page size: the 'size' property
        1. Rendering page boxes that do not fit a target sheet
        2. Positioning the page box on the sheet
      3. Crop marks: the 'marks' property
      4. Left, right, and first pages
      5. Content outside the page box
    3. Page breaks
      1. Page break properties: 'page-break-before', 'page-break-after', 'orphans', and 'widows'
      2. Allowed page breaks
      3. Forced page breaks
      4. "Best" page breaks
    4. Cascading in the page context
  13. Colors and Backgrounds
    1. Foreground color: the 'color' property
    2. The background
      1. Background properties: 'background-color', 'background-image', 'background-repeat', 'background-attachment', 'background-position', and 'background'
  14. Fonts
    1. Introduction
    2. Font specification
      1. Font specification properties
      2. Font family: the 'font-family'
      3. Font style: the 'font-style', 'font-variant', and 'font-weight' properties
      4. Font size: the 'font-size' and 'font-size-adjust' properties
      5. Shorthand font property: the 'font' property
      6. Generic font families
        1. serif
        2. sans-serif
        3. cursive
        4. fantasy
        5. monospace
    3. Font selection
      1. Font Descriptions and @font-face
      2. Descriptors for Selecting a Font: 'font-family', 'font-style', 'font-variant', 'font-weight', and 'font-size'
      3. Descriptors for Font Data Qualification: 'unicode-range'
      4. Descriptor for Numeric Values: 'units-per-em'
      5. Descriptor for Referencing: 'src'
      6. Descriptors for Matching: 'panose-1', 'stemv', 'stemh', 'slope', 'cap-height', 'x-height', 'ascent', and 'descent'
      7. Descriptors for Synthesis: 'widths' and 'definition-src'
      8. Descriptors for Alignment: 'baseline', 'centerline', 'mathline', and 'topline'
    4. Font Characteristics
      1. Introducing Font Characteristics
      2. Adorned font name
      3. Central Baseline
      4. Co-ordinate units on the em square
      5. Font encoding tables
      6. Font family name
      7. Glyph Representation widths
      8. Horizontal stem width
      9. Height of capital glyph representations
      10. Height of lowercase glyph representations
      11. Lower Baseline
      12. Mathematical Baseline
      13. Maximal bounding box
      14. Maximum unaccented height
      15. Maximum unaccented depth
      16. Panose-1 number
      17. Range of ISO10646characters
      18. Top Baseline
      19. Vertical stem width
      20. Vertical stroke angle
    5. Font matching algorithm
      1. Examples of font matching
  15. Text
    1. Indentation: the 'text-indent' property
    2. Alignment the 'text-align' property
    3. Decoration
      1. Underlining, over lining, striking, and blinking: the 'text-decoration' property
      2. Text shadows: the 'text-shadow' property
    4. Letter and word spacing: the 'letter-spacing' and 'word-spacing' properties
    5. Case
      1. Capitalization: the 'text-transform' property
      2. Special first letter/first line
    6. White space: the 'white-space' property
    7. Text in HTML
      1. Forcing a line break
  16. Lists
    1. Visual formatting of lists
      1. List properties: 'list-style-type', 'list-style-image', 'list-style-position', and 'list-style'
  17. Tables
    1. Building visual tables
      1. The 'display' property
      2. Cell spanning properties: 'column-span', and 'row-span'
    2. Layout model of elements inside tables
      1. Margins on rows, columns and cells
      2. Interactions between rows and columns
        1. Labeled diagram:
      3. The 'border-collapse' property
      4. The border styles
    3. Computing widths and heights
      1. The 'table-layout' property
      2. The 'collapse' value for the 'visibility' property
    4. 'Vertical-align' on table cells
    5. Table elements in selectors
      1. Columns and cell selectors
      2. Row, column and cell pseudo-classes
        1. Row pseudo-classes:
        2. Column pseudo-classes:
    6. HTML 4.0 default table stylesheet
    7. UNDER CONSTRUCTION! -material yet to be integrated, substituted, or discarded
      1. Table layout
      2. Computing widths and heights
      3. Placement of the borders: 'cell-spacing'
      4. Conflict resolution for borders
      5. Properties for columns and rows
      6. Vertical alignment of cells in a row
      7. Horizontal alignment of cells in a column
      8. Table captions: the 'caption-side' property
      9. Generating speech: the 'speak-header' property
      10. Table implementation notes
  18. User interface
    1. Cursors: the 'cursor' property
    2. User preferences for colors
    3. User preferences for fonts
    4. Other rendering issues that depend on user agents
      1. Magnification
  19. Aural style sheets
    1. Introduction to aural style sheets
    2. Volume properties: 'volume'
    3. Speaking properties: 'speak'
    4. Pause properties: 'pause-before', 'pause-after', and 'pause'
    5. Cue properties: 'cue-before', 'cue-after', and 'cue'
    6. Mixing properties: 'play-during'
    7. Spatial properties: 'azimuth' and 'elevation'
    8. Voice characteristic properties: 'speech-rate', 'voice-family', 'pitch', 'pitch-range', 'stress', and 'richness'
    9. Speech properties: 'speak-punctuation', 'speak-date', 'speak-numeral', and 'speak-time'
  1. Appendix A: A sample style sheet for HTML 4.0
  2. Appendix B: Changes from CSS1
    1. New functionality
    2. Updated descriptions
    3. Changes
  3. Appendix C: Implementation and performance notes
    1. Order of property value calculation
    2. Colors
      1. Gamma Correction
    3. Fonts
      1. Glossary of font terms
      2. Font retrieval
      3. Meaning of the Panose Digits
      4. Deducing Unicode Ranges for TrueType
  4. Appendix D: The grammar of CSS2
    1. Grammar
    2. Lexical scanner

Copyright  ©  1997 W3C (MIT, INRIA, Keio ), All Rights Reserved.