This specification defines the Cascading Style Sheet language, Level 2.
This is [not yet] 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/>.
CSS2 replaces CSS1, specified in http://www.w3.org/TR/REC-CSS1-961217
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/.
1 About the CSS2 Specification
1.1 How to read the specification
1.2 How the specification is organized
1.3 Acknowledgments
2 Introduction to CSS2
2.1 A brief CSS2 tutorial
2.2 Design principles behind CSS2
2.3 Tips for style sheet authors
3 Definitions and document conventions
3.1 Definitions
3.1.1 Object language
3.1.2 Element
3.1.3 Document tree
3.1.4 Inheritance
3.1.5 User
agent (or UA)
3.1.6 Conforming user
agent
3.1.7 Default style
sheet
3.1.8 Canvas
3.2 Conventions
3.2.1 CSS property definitions
3.2.2 HTML conventions
4 CSS2 syntax and basic data types
4.1 Syntax
4.1.1 Characters and case
4.1.2 Statements
4.1.3 At-rules
4.1.4 Blocks
4.1.5 Rule sets, declaration blocks, and selector-strings
4.1.6 Properties
4.1.7 Comments
4.1.8 Error handling
4.2 Basic Data types
4.2.1 Integers and numbers
4.2.2 Lengths
4.2.3 Percentages
4.2.4 URLs
4.2.5 Colors
4.2.6 Angles
4.2.7 Time
4.2.8 Frequencies
4.3 CSS and HTML
5 Selectors
5.1 Type selectors
5.2 Grouping
5.3 Contextual selectors
5.4 Sequential selectors
5.5 Pseudo-elements and pseudo-classes
5.5.1 Overlapping pseudo-elements
5.5.2 Pseudo-elements with contextual selectors
5.5.3 Typographical pseudo-elements: :first-line and
:first-letter
:first-line
:first-letter
5.5.4 Anchor pseudo-classes in HTML:
:link,
:visited,
and
:active
5.6 Attribute selectors
5.6.1 Attribute selectors in HTML
5.6.2 The class attribute
5.6.3 The class attribute in other object languages
5.6.4 The id attribute
5.6.5 Pseudo-elements and pseudo-classes with attribute selectors
5.6.6 Colliding attribute selectors and pseudo-classes
6 Cascade
6.1 Cascading order
6.1.1 'Important' rules
6.1.2 Cascading order in HTML
Precedence of object language attributes
7 Media types
7.1 Specifying media-dependent style sheets
7.2 Valid media types
8 Visual flow model
8.1 The box model
8.1.1 Box dimensions
8.1.2 Margin properties
Values for <margin-width>
'margin-top'
'margin-right'
'margin-bottom'
'margin-left'
'margin'
8.1.3 Padding properties
Values for <padding-width>
'padding-top'
'padding-right'
'padding-bottom'
'padding-left'
'padding'
8.1.4 Border properties
Values for <border-width>
'border-top-width'
'border-right-width'
'border-bottom-width'
'border-left-width'
'border-width'
'border-color'
'border-style'
'border-top'
'border-bottom'
'border-right'
'border-left'
'border'
8.1.5 Example of margins, padding, and borders
8.2 The flow model
8.2.1 Block level layout
List-item elements
8.2.2 Inline layout
8.2.3 Relative positioning
8.2.4 Controlling layout behavior
'display'
8.3 Outside the flow
8.3.1 Floats
'float'
'clear'
8.3.2 Absolute positioning
'left'
'top'
'right'
'bottom'
'position'
8.4 Comparison of normal, relative, floating, and absolute positioning
8.5 Z-order: Layered presentation
8.5.1 Calculating the stack level
'z-index'
8.6 Multicolumn layout
9 Visual flow model details
9.1 Box width calculations
'width'
9.1.1 Relationship of width dimensions
9.1.2 Width of floats and replaced elements
9.1.3 Width of absolutely positioned elements
9.1.4 Minimum and maximum widths
'min-width'
'max-width'
9.2 Box height calculations
'height'
9.2.1 Height of replaced elements
9.2.2 Height of absolutely positioned elements
9.2.3 Minimum and maximum heights
'min-height'
'max-height'
9.2.4 Collapsing margins
9.3 Scaling
'aspect-ratio'
9.4 Line height calculations
'line-height'
'vertical-align'
9.5 Floating constraints
Float overlap
9.6 Overflow and clipping
9.6.1 Overflow
'overflow'
9.6.2 Clipping
'clip'
9.7 Visibility
'visibility'
9.8 Dynamic positioning
9.9 Filters
10 Colors and Backgrounds
10.1 Foreground properties
'color'
10.2 Background properties
'background-color'
'background-image'
'background-repeat'
'background-attachment'
'background-position'
'background'
11 Fonts
11.1 Font specification
11.1.1 Font family
'font-family'
11.1.2 Font style
'font-style'
'font-variant'
'font-weight'
11.1.3 Font size
'font-size'
11.1.4 The 'font' shorthand property
'font'
11.2 Font selection
11.2.1 Font Descriptions and @font-face
11.2.2 Font-face Descriptors for Selecting a Font
'font-family'
'font-style'
'font-variant'
'font-weight'
'font-size'
11.2.3 Font-face Descriptors for Font Data Qualification
'unicode-range'
11.2.4 Font-face Descriptors for Numeric Values
'units-per-em'
11.2.5 Font-face Descriptors for Referencing
'src'
11.2.6 Font-face Descriptors for Matching
'panose-1'
'stemv'
'stemh'
'slope'
'cap-height'
'x-height'
'ascent'
'descent'
11.2.7 Font-face Descriptors for Synthesis
'widths'
'definition-src'
11.2.8 Font-face Descriptors for Alignment
'centerline'
'mathline'
'topline'
11.2.9 General Font Descriptors
Adorned font name
Central Baseline
Co-ordinate units on the em square
Font encoding tables
Font family name
Glyph Representation widths
Glyph Representation heights
Horizontal stem width
Height of capital glyph representations
Height of lowercase glyph representations
Mathematical Baseline
Maximal bounding box
Maximum unaccented height
Maximum unaccented depth
Panose-1 number
Range of Unicode characters
Top Baseline
Vertical stem width
Vertical stroke angle
11.2.10 Fonts for Multiple Media
11.3 Font matching algorithm
11.3.1 Examples of font matching
12 Text
12.1 White space
'white-space'
12.2 Case
12.2.1 Capitalization
'text-transform'
12.2.2 Special first letter/first line
12.3 Letter and word spacing
'letter-spacing'
'word-spacing'
12.4 Indentation
'text-indent'
12.5 Alignment
'alignment'
12.6 Decoration
12.6.1 Underlining, over lining, striking, and blinking
'text-decoration'
12.6.2 Text shadows
text-shadow-color'
12.7 Generated text
12.8 Automatic numbering
12.9 Text in HTML
12.9.1 Forcing a line break
13 Lists
13.1 Visual formatting of lists
13.1.1 List properties
'list-style-type'
'list-style-image'
'list-style-position'
'list-style'
14 Tables
14.1 Table layout
'column-span'
'row-span'
'direction'
14.2 Computing widths and heights
14.3 Placement of the borders
14.4 Conflict resolution for borders
14.5 Properties for columns and rows
14.6 Vertical alignment of cells in a row
14.7 Horizontal alignment of cells in a column
14.8 Table captions
'caption-side'
14.9 Floating elements inside cells
14.10 Generating speech
'speak-header-cell'
14.11 Table implementation notes
15 User interface
15.1 Cursors
'cursor'
15.2 User preferences for colors and fonts
15.2.1 System Colors
15.2.2 System fonts
15.3 Other rendering issues that depend on user agents
15.3.1 Magnification
16 Aural style sheets
16.1 Aural cascading style sheet properties
16.1.1 Volume properties
'volume'
16.1.2 Speaking properties
'speak'
16.1.3 Pause properties
'pause-after'
'pause'
16.1.4 Cue properties
'cue-before'
'cue-after'
'cue'
16.1.5 Mixing properties
'play-during'
16.1.6 Spatial properties
'azimuth'
'elevation'
16.1.7 Voice characteristic properties
'speech-rate'
'voice-family'
'pitch'
'pitch-range'
'stress'
'richness'
'speak-punctuation'
'speak-date'
'speak-numeral'
'speak-time'
17 Printing with style sheets
17.1 Background to printing
17.2 The page model
17.3 Page breaks
17.3.1 Page break properties
'page-break-before'
'page-break-after'
'orphan'
'widow'
17.3.2 Allowed page breaks
17.3.3 Forced page breaks
17.3.4 "Best" page breaks
17.4 Page boxes: the @page rule
17.4.1 @page properties
'size'
'marks'
17.5 Pseudo-class page boxes
17.6 Cascading in the page context
Appendix A: A sample style sheet for HTML 2.0
Appendix C: Implementation and performance
notes
Colors
Gamma Correction
Fonts
Glossary of font terms
Font retrieval
Printing
Future extensions
Appendix D: The grammar of CSS2