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,fonts and aural cues)spacing) 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 Membersthe height/width of absolutely positioned
elements, more influence for HTML's "style" attribute and other interested partiesa new
calculation of the 'clip' property), and hasadds a few highly requested
features which have already been endorsed by the Director aswidely implemented.
But most of all CSS 2.1
represents a W3C Recommendation."snapshot" of CSS usage: it consists of all CSS features
that are implemented interoperably at the date of publication of the Recommendation.
CSS 2.1 is a stable documentderived from and is intended to replace CSS2. Some
parts of CSS2 are unchanged in CSS 2.1, some parts have been
altered, and some parts removed. The removed portions may be used asin a
future CSS3 specification. Future specs should refer to CSS 2.1
(unless they need features from CSS2 which have been dropped in
CSS 2.1, and then they should only reference materialCSS2 for those
features, or cited as a normativepreferably reference from another document. W3C's rolesuch feature(s) in making the Recommendation is to draw attention tothe specification and to promote its widespread deployment.respective
CSS3 Module that includes those feature(s)).
Status of this document
This enhancessection describes the functionality and interoperabilitystatus of this document at the Web.time
of its publication. Other documents may supersede this document. A list of
current W3C Recommendationspublications and otherthe latest revision of this technical
documentsreport can be found in the W3C
technical reports index at http://www.w3.org/TRhttp://www.w3.org/TR/.
Public discussionThis working draft contains most of CSS features takes placethe changes that resulted from
comments on www-style@w3.org . Available formatsthe CSS2 specificationprevious draft, but not all of them. It is availablepublished
in the following formats: HTML: http://www.w3.org/TR/1998/REC-CSS2-19980512hope that it can help people check that those changes are
correct. It is expected that the next publication will be a plainCandidate
Recommendation.
The (archived)
public mailing list www-style@w3.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 file: http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.txt , HTML as a gzip'ed tar file: http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.tgz , HTML"CSS21" in the subject, preferably
like this: "[CSS21] <summary of comment>"
Publication as a zip file (thisWorking Draft does not imply endorsement by the
W3C Membership. This is a '.zip' file not an '.exe'): http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.zip , as welldraft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to
cite this document as other
than work in progress.
A gzip'ed PostScript file: http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.ps.gz ,test suite and a PDF file: http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.pdf . In casereport on implementations will be provided
before the document becomes a Proposed Recommendation.
This document is produced by the CSS
working group (part of the Style Activity,
see summary).
This document was produced by a discrepancy betweengroup operating under the 24 January 2002 CPP
as amended by the W3C Patent
Policy Transition Procedure. W3C maintains a public list of any patent
disclosures made in connection with the various formsdeliverables of the specification, http://www.w3.org/TR/1998/REC-CSS2-19980512 is consideredgroup;
that page also includes instructions for disclosing a patent. An
individual who has actual knowledge of a patent which the definitive version. Available languagesindividual
believes contains Essential
Claim(s) must disclose the English versioninformation in accordance with
section 6 of the W3C Patent Policy.
Candidate Recommendation Exit Criteria
For this specification isto exit the only normative version. However,CR stage, the following
conditions must be met:
-
There must be at least two interoperable implementations
for translationsevery feature. For the purposes of this criterion,
we define the following terms:
- feature
-
A section or subsection of the specification.
- interoperable
-
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.
- implementation
-
a user agent which:
- implements the feature.
- is available (i.e. publicly downloadable or available
through some other
languages see http://www.w3.org/Style/css2-updates/translations.html . Erratapublic point of sale mechanism). This is the
list"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 known errors insix months of the CR period must have elapsed.
This specificationis available at http://www.w3.org/Style/css2-updates/REC-CSS2-19980512-errata.html . Please reportto ensure that enough time is given for any remaining major
errors in this documentto css2-editors@w3.org . Quick Table of Contents 1 Aboutbe caught.
The CSS2 Specification 2 IntroductionCR period will be extended if implementations are slow to
CSS2 3 Conformance: Requirements and Recommendations 4 CSS2 syntax and basic dataappear.
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.
Features at risk
The working group has identified the following features as being
currently poorly implemented by UAs. They are therefore most at risk
of being removed from CSS 2.1 when exiting CR. (Any changes of this
nature will still result in the specification being returned to last
call.) Implementors are urged to implement these features, or correct
bugs in their implementations, if they wish to see these features remain
in this specification.
- New 'list-style-type' values
-
- 'armenian'
- 'georgian'
- 'lower-greek'
Implementors should look at CSS3 Lists instead, where these and
many other new values not found in CSS1 are defined in detail.
[CSS3LIST]
- Support for multiple ID attributes for the ID selector
-
Because implementations are not expected to support multiple IDs
per element soon, this feature may be made informative. The W3C
Selectors specification will continue to have this feature
normatively. (Section
5.9.)
- Automatic table layout algorithm
-
The input to the suggested (non-normative) automatic layout
algorithm for tables is restricted to (1) the containing block width
and (2) the content and properties of the table and its
children. This restriction may be lifted.
- Quotes
-
The 'quotes' property and the
'open-quote', 'close-quote', 'no-open-quote' and 'no-close-quote'
keywords may be dropped.
- 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-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
ComputingCalculating 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
ComputingCalculating 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 non-replaced elements in normal flow, and floating, non-replaced elementsflow when 'overflow' computes to 'visible'
- 10.6.4 Absolutely positioned, non-replaced elements
- 10.6.5 Absolutely positioned, replaced elements
- 10.6.6 Block-level, non-replaced elements in normal flow when 'overflow' does not compute to 'visible'; 'inline-block', non-replaced elements; and floating, non-replaced elements
- 10.6.7 'Auto' heights for block formatting context roots
- 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
- 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.5
- C.3.26 Section 16.6 Whitespace: the 'white-space' property
- C.3.27 Section 17.2 The CSS table model
- C.3.28 17.2.1 Anonymous table objects
- C.3.29 17.5 Visual layout of table contents
- C.3.30 17.5 Visual layout of table contents
- C.3.31 Section 17.5.1 Table layers and transparency
- C.3.32 Section 17.6.1 The separated borders model
- C.3.33 Appendix D.2 Lexical scanner
- C.4 Clarifications
- C.4.1 2.2 A brief CSS2 tutorial for XML
- C.4.2 Section 4.1.1
- C.4.3 Section 5.5
- C.4.4 Section 5.9 ID selectors
- C.4.5 Section 5.12.1 The :first-line pseudo-element
- C.4.6 Section 6.2.1
- C.4.7 6.4 The Cascade
- C.4.8 Section 6.4.3 Calculating a selector's specificity
- C.4.9 Section 7.3 Recognized media types
- C.4.10 Section 8.1
- C.4.11 Section 8.3.1
- C.4.12 Section 9.4.2
- C.4.13 Section 9.4.3
- C.4.14 Section 9.10
- C.4.15 10.3.3 Block-level, non-replaced elements in normal flow
- C.4.16 Section 10.5 Content height: the 'height' property
- C.4.17 Section 10.8.1
- C.4.18 Section 11.1
- C.4.19 Section 11.1.1
- C.4.20 Section 11.1.2
- C.4.21 12.1 The :before and
alignment 17.5 Visual layout of table contents:after pseudo-elements
- C.4.22 Section 12.4.2 Inserting quotes with the 'content' property
- C.4.23 Lists 12.6.2
- C.4.24 14.2 The background
- C.4.25 14.2.1 Background properties
- C.4.26 Section 16.1
- C.4.27 16.2 Alignment: the 'text-align' property
- C.4.28 Section 17.5.1 Table layers and transparency
- C.4.29 Section 17.5.2 Table width
algorithms: the 'table-layout' property Fixed table layout Automatic table layout 17.5.3 Table heightalgorithms
-
17.5.4 Horizontal alignment in a column 17.5.5 Dynamic row and column effects 17.6 BordersC.4.30 17.6.1 The separated borders model
- C.4.31 Borders around empty cells: the 'empty-cells' property
- C.4.32 Section 17.6.2 The collapsing
borderborders model
-
Border conflict resolution 17.6.3 Border styles 17.7 Audio rendering of tables 17.7.1 Speaking headers: the 'speak-header' property 18 User interface 18.1 Cursors: the 'cursor' propertyC.4.33 Section 18.2
-
User preferences for colors 18.3 User preferences for fonts 18.4 Dynamic outlines: the 'outline' property 18.4.1 Outlines and the focus 18.5 Magnification 19 Aural style sheets 19.1 Introduction to aural style sheets 19.2 Volume properties: 'volume' 19.3 Speaking properties: 'speak' 19.4 Pause properties: 'pause-before' , 'pause-after' , and 'pause' 19.5 Cue properties: 'cue-before' , 'cue-after' , and 'cue' 19.6 Mixing properties: 'play-during' 19.7 Spatial properties: 'azimuth' and 'elevation' 19.8 Voice characteristic properties: 'speech-rate' , 'voice-family' , 'pitch' , 'pitch-range' , 'stress' , and 'richness' 19.9 Speech properties: 'speak-punctuation' and 'speak-numeral'C.4.34 Section A.3
- C.4.35 Appendix
A. A sampleG.2 Lexical scanner
- C.4.36 Appendix E. References
- Appendix D. Default style sheet for HTML
4.0 Appendix B. Changes from CSS1 B.1 New functionality B.2 Updated descriptions B.3 Semantic changes from CSS14
- Appendix
C. Implementation and performance notes for fonts C.1 Glossary of font terms C.2 Font retrieval C.3 MeaningE. Elaborate description of the Panose Digits C.4 Deducing Unicode Ranges for TrueType C.5 Automatic descriptor generationStacking Contexts
- Appendix
D. TheF. Full property table
- Appendix G. Grammar of
CSS2 D.1CSS 2.1
- Appendix
E. References E.1 Normative references E.2 Informative references Appendix F. Property index Appendix G. Descriptor index Appendix H.I. Index