home *** CD-ROM | disk | FTP | other *** search
/ XML Bible (2nd Edition) / XML_Bible_Second_Edition_Hungry_Minds_2001.iso / mac / specs / css2.txt < prev    next >
Text File  |  2001-03-12  |  623KB  |  15,703 lines

  1.   ------------------------------------------------------------------------
  2.  
  3.                                                            REC-CSS2-19980512
  4.  
  5.                        Cascading Style Sheets, level 2
  6.                              CSS2 Specification
  7.  
  8.                        W3C Recommendation 12-May-1998
  9.  
  10. This version:
  11.      http://www.w3.org/TR/1998/REC-CSS2-19980512
  12. Latest version:
  13.      http://www.w3.org/TR/REC-CSS2
  14. Previous version:
  15.      http://www.w3.org/TR/1998/PR-CSS2-19980324
  16. Editors:
  17.      Bert Bos <bbos@w3.org>
  18.      HÂkon Wium Lie <howcome@w3.org>
  19.      Chris Lilley <chris@w3.org>
  20.      Ian Jacobs <ij@w3.org>
  21.  
  22. Abstract
  23.  
  24. This specification defines Cascading Style Sheets, level 2 (CSS2). CSS2 is a
  25. style sheet language that allows authors and users to attach style (e.g.,
  26. fonts, spacing, and aural cues) to structured documents (e.g., HTML
  27. documents and XML applications). By separating the presentation style of
  28. documents from the content of documents, CSS2 simplifies Web authoring and
  29. site maintenance.
  30.  
  31. CSS2 builds on CSS1 (see [CSS1]) and, with very few exceptions, all valid
  32. CSS1 style sheets are valid CSS2 style sheets. CSS2 supports media-specific
  33. style sheets so that authors may tailor the presentation of their documents
  34. to visual browsers, aural devices, printers, braille devices, handheld
  35. devices, etc. This specification also supports content positioning,
  36. downloadable fonts, table layout, features for internationalization,
  37. automatic counters and numbering, and some properties related to user
  38. interface.
  39.  
  40. Status of this document
  41.  
  42. This document has been reviewed by W3C Members and other interested parties
  43. and has been endorsed by the Director as a W3C Recommendation. It is a
  44. stable document and may be used as reference material or cited as a
  45. normative reference from another document. W3C's role in making the
  46. Recommendation is to draw attention to the specification and to promote its
  47. widespread deployment. This enhances the functionality and interoperability
  48. of the Web.
  49.  
  50. A list of current W3C Recommendations and other technical documents can be
  51. found at http://www.w3.org/TR.
  52.  
  53. Public discussion of CSS features takes place on www-style@w3.org.
  54.  
  55. Available formats
  56.  
  57. The CSS2 specification is available in the following formats:
  58.  
  59. HTML:
  60.      http://www.w3.org/TR/1998/REC-CSS2-19980512
  61. a plain text file:
  62.      http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.txt,
  63. HTML as a gzip'ed tar file:
  64.      http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.tgz,
  65. HTML as a zip file (this is a '.zip' file not an '.exe'):
  66.      http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.zip,
  67. as well as a gzip'ed PostScript file:
  68.      http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.ps.gz,
  69. and a PDF file:
  70.      http://www.w3.org/TR/1998/REC-CSS2-19980512/css2.pdf.
  71.  
  72. In case of a discrepancy between the various forms of the specification,
  73. http://www.w3.org/TR/1998/REC-CSS2-19980512 is considered the definitive
  74. version.
  75.  
  76. Available languages
  77.  
  78. The English version of this specification is the only normative version.
  79. However, for translations in other languages see
  80. http://www.w3.org/Style/css2-updates/translations.html.
  81.  
  82. Errata
  83.  
  84. The list of known errors in this specification is available at
  85. http://www.w3.org/Style/css2-updates/REC-CSS2-19980512-errata.html. Please
  86. report errors in this document to css2-editors@w3.org.
  87.  
  88. Quick Table of Contents
  89.  
  90.    * 1 About the CSS2 Specification
  91.    * 2 Introduction to CSS2
  92.    * 3 Conformance: Requirements and Recommendations
  93.    * 4 CSS2 syntax and basic data types
  94.    * 5 Selectors
  95.    * 6 Assigning property values, Cascading, and Inheritance
  96.    * 7 Media types
  97.    * 8 Box model
  98.    * 9 Visual formatting model
  99.    * 10 Visual formatting model details
  100.    * 11 Visual effects
  101.    * 12 Generated content, automatic numbering, and lists
  102.    * 13 Paged media
  103.    * 14 Colors and Backgrounds
  104.    * 15 Fonts
  105.    * 16 Text
  106.    * 17 Tables
  107.    * 18 User interface
  108.    * 19 Aural style sheets
  109.    * Appendix A. A sample style sheet for HTML 4.0
  110.    * Appendix B. Changes from CSS1
  111.    * Appendix C. Implementation and performance notes for fonts
  112.    * Appendix D. The grammar of CSS2
  113.    * Appendix E. References
  114.    * Appendix F. Property index
  115.    * Appendix G. Descriptor index
  116.    * Appendix H. Index
  117.  
  118. Full Table of Contents
  119.  
  120.    * 1 About the CSS2 Specification
  121.         o 1.1 Reading the specification
  122.         o 1.2 How the specification is organized
  123.         o 1.3 Conventions
  124.              + 1.3.1 Document language elements and attributes
  125.              + 1.3.2 CSS property definitions
  126.                   + Value
  127.                   + Initial
  128.                   + Applies to
  129.                   + Inherited
  130.                   + Percentage values
  131.                   + Media groups
  132.              + 1.3.3 Shorthand properties
  133.              + 1.3.4 Notes and examples
  134.              + 1.3.5 Images and long descriptions
  135.         o 1.4 Acknowledgments
  136.         o 1.5 Copyright Notice
  137.    * 2 Introduction to CSS2
  138.         o 2.1 A brief CSS2 tutorial for HTML
  139.         o 2.2 A brief CSS2 tutorial for XML
  140.         o 2.3 The CSS2 processing model
  141.              + 2.3.1 The canvas
  142.              + 2.3.2 CSS2 addressing model
  143.         o 2.4 CSS design principles
  144.    * 3 Conformance: Requirements and Recommendations
  145.         o 3.1 Definitions
  146.         o 3.2 Conformance
  147.         o 3.3 Error conditions
  148.         o 3.4 The text/css content type
  149.    * 4 CSS2 syntax and basic data types
  150.         o 4.1 Syntax
  151.              + 4.1.1 Tokenization
  152.              + 4.1.2 Keywords
  153.              + 4.1.3 Characters and case
  154.              + 4.1.4 Statements
  155.              + 4.1.5 At-rules
  156.              + 4.1.6 Blocks
  157.              + 4.1.7 Rule sets, declaration blocks, and selectors
  158.              + 4.1.8 Declarations and properties
  159.              + 4.1.9 Comments
  160.         o 4.2 Rules for handling parsing errors
  161.         o 4.3 Values
  162.              + 4.3.1 Integers and real numbers
  163.              + 4.3.2 Lengths
  164.              + 4.3.3 Percentages
  165.              + 4.3.4 URL + URN = URI
  166.              + 4.3.5 Counters
  167.              + 4.3.6 Colors
  168.              + 4.3.7 Angles
  169.              + 4.3.8 Times
  170.              + 4.3.9 Frequencies
  171.              + 4.3.10 Strings
  172.         o 4.4 CSS document representation
  173.              + 4.4.1 Referring to characters not represented in a character
  174.                encoding
  175.    * 5 Selectors
  176.         o 5.1 Pattern matching
  177.         o 5.2 Selector syntax
  178.              + 5.2.1 Grouping
  179.         o 5.3 Universal selector
  180.         o 5.4 Type selectors
  181.         o 5.5 Descendant selectors
  182.         o 5.6 Child selectors
  183.         o 5.7 Adjacent sibling selectors
  184.         o 5.8 Attribute selectors
  185.              + 5.8.1 Matching attributes and attribute values
  186.              + 5.8.2 Default attribute values in DTDs
  187.              + 5.8.3 Class selectors
  188.         o 5.9 ID selectors
  189.         o 5.10 Pseudo-elements and pseudo-classes
  190.         o 5.11 Pseudo-classes
  191.              + 5.11.1 :first-child pseudo-class
  192.              + 5.11.2 The link pseudo-classes: :link and :visited
  193.              + 5.11.3 The dynamic pseudo-classes: :hover, :active, and
  194.                :focus
  195.              + 5.11.4 The language pseudo-class: :lang
  196.         o 5.12 Pseudo-elements
  197.              + 5.12.1 The :first-line pseudo-element
  198.              + 5.12.2 The :first-letter pseudo-element
  199.              + 5.12.3 The :before and :after pseudo-elements
  200.    * 6 Assigning property values, Cascading, and Inheritance
  201.         o 6.1 Specified, computed, and actual values
  202.              + 6.1.1 Specified values
  203.              + 6.1.2 Computed values
  204.              + 6.1.3 Actual values
  205.         o 6.2 Inheritance
  206.              + 6.2.1 The 'inherit' value
  207.         o 6.3 The @import rule
  208.         o 6.4 The cascade
  209.              + 6.4.1 Cascading order
  210.              + 6.4.2 !important rules
  211.              + 6.4.3 Calculating a selector's specificity
  212.              + 6.4.4 Precedence of non-CSS presentational hints
  213.    * 7 Media types
  214.         o 7.1 Introduction to media types
  215.         o 7.2 Specifying media-dependent style sheets
  216.              + 7.2.1 The @media rule
  217.         o 7.3 Recognized media types
  218.              + 7.3.1 Media groups
  219.    * 8 Box model
  220.         o 8.1 Box dimensions
  221.         o 8.2 Example of margins, padding, and borders
  222.         o 8.3 Margin properties: 'margin-top', 'margin-right',
  223.           'margin-bottom', 'margin-left', and 'margin'
  224.              + 8.3.1 Collapsing margins
  225.         o 8.4 Padding properties: 'padding-top', 'padding-right',
  226.           'padding-bottom', 'padding-left', and 'padding'
  227.         o 8.5 Border properties
  228.              + 8.5.1 Border width: 'border-top-width', 'border-right-width',
  229.                'border-bottom-width', 'border-left-width', and
  230.                'border-width'
  231.              + 8.5.2 Border color: 'border-top-color', 'border-right-color',
  232.                'border-bottom-color', 'border-left-color', and
  233.                'border-color'
  234.              + 8.5.3 Border style: 'border-top-style', 'border-right-style',
  235.                'border-bottom-style', 'border-left-style', and
  236.                'border-style'
  237.              + 8.5.4 Border shorthand properties: 'border-top',
  238.                'border-bottom', 'border-right', 'border-left', and 'border'
  239.    * 9 Visual formatting model
  240.         o 9.1 Introduction to the visual formatting model
  241.              + 9.1.1 The viewport
  242.              + 9.1.2 Containing blocks
  243.         o 9.2 Controlling box generation
  244.              + 9.2.1 Block-level elements and block boxes
  245.                   + Anonymous block boxes
  246.              + 9.2.2 Inline-level elements and inline boxes
  247.                   + Anonymous inline boxes
  248.              + 9.2.3 Compact boxes
  249.              + 9.2.4 Run-in boxes
  250.              + 9.2.5 The 'display' property
  251.         o 9.3 Positioning schemes
  252.              + 9.3.1 Choosing a positioning scheme: 'position' property
  253.              + 9.3.2 Box offsets: 'top', 'right', 'bottom', 'left'
  254.         o 9.4 Normal flow
  255.              + 9.4.1 Block formatting context
  256.              + 9.4.2 Inline formatting context
  257.              + 9.4.3 Relative positioning
  258.         o 9.5 Floats
  259.              + 9.5.1 Positioning the float: the 'float' property
  260.              + 9.5.2 Controlling flow next to floats: the 'clear' property
  261.         o 9.6 Absolute positioning
  262.              + 9.6.1 Fixed positioning
  263.         o 9.7 Relationships between 'display', 'position', and 'float'
  264.         o 9.8 Comparison of normal flow, floats, and absolute positioning
  265.              + 9.8.1 Normal flow
  266.              + 9.8.2 Relative positioning
  267.              + 9.8.3 Floating a box
  268.              + 9.8.4 Absolute positioning
  269.         o 9.9 Layered presentation
  270.              + 9.9.1 Specifying the stack level: the 'z-index' property
  271.         o 9.10 Text direction: the 'direction' and 'unicode-bidi' properties
  272.    * 10 Visual formatting model details
  273.         o 10.1 Definition of "containing block"
  274.         o 10.2 Content width: the 'width' property
  275.         o 10.3 Computing widths and margins
  276.              + 10.3.1 Inline, non-replaced elements
  277.              + 10.3.2 Inline, replaced elements
  278.              + 10.3.3 Block-level, non-replaced elements in normal flow
  279.              + 10.3.4 Block-level, replaced elements in normal flow
  280.              + 10.3.5 Floating, non-replaced elements
  281.              + 10.3.6 Floating, replaced elements
  282.              + 10.3.7 Absolutely positioned, non-replaced elements
  283.              + 10.3.8 Absolutely positioned, replaced elements
  284.         o 10.4 Minimum and maximum widths: 'min-width' and 'max-width'
  285.         o 10.5 Content height: the 'height' property
  286.         o 10.6 Computing heights and margins
  287.              + 10.6.1 Inline, non-replaced elements
  288.              + 10.6.2 Inline, replaced elements block-level, replaced
  289.                elements in normal flow, and floating, replaced elements
  290.              + 10.6.3 Block-level, non-replaced elements in normal flow, and
  291.                floating, non-replaced elements
  292.              + 10.6.4 Absolutely positioned, non-replaced elements
  293.              + 10.6.5 Absolutely positioned, replaced elements
  294.         o 10.7 Minimum and maximum heights: 'min-height' and 'max-height'
  295.         o 10.8 Line height calculations: the 'line-height' and
  296.           'vertical-align' properties
  297.              + 10.8.1 Leading and half-leading
  298.    * 11 Visual effects
  299.         o 11.1 Overflow and clipping
  300.              + 11.1.1 Overflow: the 'overflow' property
  301.              + 11.1.2 Clipping: the 'clip' property
  302.         o 11.2 Visibility: the 'visibility' property
  303.    * 12 Generated content, automatic numbering, and lists
  304.         o 12.1 The :before and :after pseudo-elements
  305.         o 12.2 The 'content' property
  306.         o 12.3 Interaction of :before and :after with 'compact' and 'run-in'
  307.           elements
  308.         o 12.4 Quotation marks
  309.              + 12.4.1 Specifying quotes with the 'quotes' property
  310.              + 12.4.2 Inserting quotes with the 'content' property
  311.         o 12.5 Automatic counters and numbering
  312.              + 12.5.1 Nested counters and scope
  313.              + 12.5.2 Counter styles
  314.              + 12.5.3 Counters in elements with 'display: none'
  315.         o 12.6 Markers and lists
  316.              + 12.6.1 Markers: the 'marker-offset' property
  317.              + 12.6.2 Lists: the 'list-style-type', 'list-style-image',
  318.                'list-style-position', and 'list-style' properties
  319.    * 13 Paged media
  320.         o 13.1 Introduction to paged media
  321.         o 13.2 Page boxes: the @page rule
  322.              + 13.2.1 Page margins
  323.              + 13.2.2 Page size: the 'size' property
  324.                   + Rendering page boxes that do not fit a target sheet
  325.                   + Positioning the page box on the sheet
  326.              + 13.2.3 Crop marks: the 'marks' property
  327.              + 13.2.4 Left, right, and first pages
  328.              + 13.2.5 Content outside the page box
  329.         o 13.3 Page breaks
  330.              + 13.3.1 Break before/after elements: 'page-break-before',
  331.                'page-break-after', 'page-break-inside'
  332.              + 13.3.2 Using named pages: 'page'
  333.              + 13.3.3 Breaks inside elements: 'orphans', 'widows'
  334.              + 13.3.4 Allowed page breaks
  335.              + 13.3.5 Forced page breaks
  336.              + 13.3.6 "Best" page breaks
  337.         o 13.4 Cascading in the page context
  338.    * 14 Colors and Backgrounds
  339.         o 14.1 Foreground color: the 'color' property
  340.         o 14.2 The background
  341.              + 14.2.1 Background properties: 'background-color',
  342.                'background-image', 'background-repeat',
  343.                'background-attachment', 'background-position', and
  344.                'background'
  345.         o 14.3 Gamma correction
  346.    * 15 Fonts
  347.         o 15.1 Introduction
  348.         o 15.2 Font specification
  349.              + 15.2.1 Font specification properties
  350.              + 15.2.2 Font family: the 'font-family' property
  351.              + 15.2.3 Font styling: the 'font-style', 'font-variant',
  352.                'font-weight' and 'font-stretch' properties
  353.              + 15.2.4 Font size: the 'font-size' and 'font-size-adjust'
  354.                properties
  355.              + 15.2.5 Shorthand font property: the 'font' property
  356.              + 15.2.6 Generic font families
  357.                   + serif
  358.                   + sans-serif
  359.                   + cursive
  360.                   + fantasy
  361.                   + monospace
  362.         o 15.3 Font selection
  363.              + 15.3.1 Font Descriptions and @font-face
  364.              + 15.3.2 Descriptors for Selecting a Font: 'font-family',
  365.                'font-style', 'font-variant', 'font-weight', 'font-stretch'
  366.                and 'font-size'
  367.              + 15.3.3 Descriptors for Font Data Qualification:
  368.                'unicode-range'
  369.              + 15.3.4 Descriptor for Numeric Values: 'units-per-em'
  370.              + 15.3.5 Descriptor for Referencing: 'src'
  371.              + 15.3.6 Descriptors for Matching: 'panose-1', 'stemv',
  372.                'stemh', 'slope', 'cap-height', 'x-height', 'ascent', and
  373.                'descent'
  374.              + 15.3.7 Descriptors for Synthesis: 'widths', 'bbox' and
  375.                'definition-src'
  376.              + 15.3.8 Descriptors for Alignment: 'baseline', 'centerline',
  377.                'mathline', and 'topline'
  378.              + 15.3.9 Examples
  379.         o 15.4 Font Characteristics
  380.              + 15.4.1 Introducing Font Characteristics
  381.              + 15.4.2 Full font name
  382.              + 15.4.3 Coordinate units on the em square
  383.              + 15.4.4 Central Baseline
  384.              + 15.4.5 Font Encoding
  385.              + 15.4.6 Font family name
  386.              + 15.4.7 Glyph widths
  387.              + 15.4.8 Horizontal stem width
  388.              + 15.4.9 Height of uppercase glyphs
  389.              + 15.4.10 Height of lowercase glyphs
  390.              + 15.4.11 Lower Baseline
  391.              + 15.4.12 Mathematical Baseline
  392.              + 15.4.13 Maximal bounding box
  393.              + 15.4.14 Maximum unaccented height
  394.              + 15.4.15 Maximum unaccented depth
  395.              + 15.4.16 Panose-1 number
  396.              + 15.4.17 Range of ISO 10646 characters
  397.              + 15.4.18 Top Baseline
  398.              + 15.4.19 Vertical stem width
  399.              + 15.4.20 Vertical stroke angle
  400.         o 15.5 Font matching algorithm
  401.              + 15.5.1 Mapping font weight values to font names
  402.              + 15.5.2 Examples of font matching
  403.    * 16 Text
  404.         o 16.1 Indentation: the 'text-indent' property
  405.         o 16.2 Alignment: the 'text-align' property
  406.         o 16.3 Decoration
  407.              + 16.3.1 Underlining, overlining, striking, and blinking: the
  408.                'text-decoration' property
  409.              + 16.3.2 Text shadows: the 'text-shadow' property
  410.         o 16.4 Letter and word spacing: the 'letter-spacing' and
  411.           'word-spacing' properties
  412.         o 16.5 Capitalization: the 'text-transform' property
  413.         o 16.6 Whitespace: the 'white-space' property
  414.    * 17 Tables
  415.         o 17.1 Introduction to tables
  416.         o 17.2 The CSS table model
  417.              + 17.2.1 Anonymous table objects
  418.         o 17.3 Column selectors
  419.         o 17.4 Tables in the visual formatting model
  420.              + 17.4.1 Caption position and alignment
  421.         o 17.5 Visual layout of table contents
  422.              + 17.5.1 Table layers and transparency
  423.              + 17.5.2 Table width algorithms: the 'table-layout' property
  424.                   + Fixed table layout
  425.                   + Automatic table layout
  426.              + 17.5.3 Table height algorithms
  427.              + 17.5.4 Horizontal alignment in a column
  428.              + 17.5.5 Dynamic row and column effects
  429.         o 17.6 Borders
  430.              + 17.6.1 The separated borders model
  431.                   + Borders around empty cells: the 'empty-cells' property
  432.              + 17.6.2 The collapsing border model
  433.                   + Border conflict resolution
  434.              + 17.6.3 Border styles
  435.         o 17.7 Audio rendering of tables
  436.              + 17.7.1 Speaking headers: the 'speak-header' property
  437.    * 18 User interface
  438.         o 18.1 Cursors: the 'cursor' property
  439.         o 18.2 User preferences for colors
  440.         o 18.3 User preferences for fonts
  441.         o 18.4 Dynamic outlines: the 'outline' property
  442.              + 18.4.1 Outlines and the focus
  443.         o 18.5 Magnification
  444.    * 19 Aural style sheets
  445.         o 19.1 Introduction to aural style sheets
  446.         o 19.2 Volume properties: 'volume'
  447.         o 19.3 Speaking properties: 'speak'
  448.         o 19.4 Pause properties: 'pause-before', 'pause-after', and 'pause'
  449.         o 19.5 Cue properties: 'cue-before', 'cue-after', and 'cue'
  450.         o 19.6 Mixing properties: 'play-during'
  451.         o 19.7 Spatial properties: 'azimuth' and 'elevation'
  452.         o 19.8 Voice characteristic properties: 'speech-rate',
  453.           'voice-family', 'pitch', 'pitch-range', 'stress', and 'richness'
  454.         o 19.9 Speech properties: 'speak-punctuation' and 'speak-numeral'
  455.    * Appendix A. A sample style sheet for HTML 4.0
  456.    * Appendix B. Changes from CSS1
  457.         o B.1 New functionality
  458.         o B.2 Updated descriptions
  459.         o B.3 Semantic changes from CSS1
  460.    * Appendix C. Implementation and performance notes for fonts
  461.         o C.1 Glossary of font terms
  462.         o C.2 Font retrieval
  463.         o C.3 Meaning of the Panose Digits
  464.         o C.4 Deducing Unicode Ranges for TrueType
  465.         o C.5 Automatic descriptor generation
  466.    * Appendix D. The grammar of CSS2
  467.         o D.1 Grammar
  468.         o D.2 Lexical scanner
  469.         o D.3 Comparison of tokenization in CSS2 and CSS1
  470.    * Appendix E. References
  471.         o E.1 Normative references
  472.         o E.2 Informative references
  473.    * Appendix F. Property index
  474.    * Appendix G. Descriptor index
  475.    * Appendix H. Index
  476.  
  477.       Copyright  ©  1998 W3C (MIT, INRIA, Keio ), All Rights Reserved.
  478.  
  479.   ------------------------------------------------------------------------
  480.   ------------------------------------------------------------------------
  481.  
  482.                        1 About the CSS2 Specification
  483.  
  484. Contents
  485.  
  486.    * 1.1 Reading the specification
  487.    * 1.2 How the specification is organized
  488.    * 1.3 Conventions
  489.         o 1.3.1 Document language elements and attributes
  490.         o 1.3.2 CSS property definitions
  491.              + Value
  492.              + Initial
  493.              + Applies to
  494.              + Inherited
  495.              + Percentage values
  496.              + Media groups
  497.         o 1.3.3 Shorthand properties
  498.         o 1.3.4 Notes and examples
  499.         o 1.3.5 Images and long descriptions
  500.    * 1.4 Acknowledgments
  501.    * 1.5 Copyright Notice
  502.  
  503. 1.1 Reading the specification
  504.  
  505. This specification has been written with two types of readers in mind: CSS
  506. authors and CSS implementors. We hope the specification will provide authors
  507. with the tools they need to write efficient, attractive, and accessible
  508. documents, without overexposing them to CSS's implementation details.
  509. Implementors, however, should find all they need to build conforming user
  510. agents. The specification begins with a general presentation of CSS and
  511. becomes more and more technical and specific towards the end. For quick
  512. access to information, a general table of contents, specific tables of
  513. contents at the beginning of each section, and an index provide easy
  514. navigation, in both the electronic and printed versions.
  515.  
  516. The specification has been written with two modes of presentation in mind:
  517. electronic and printed. Although the two presentations will no doubt be
  518. similar, readers will find some differences. For example, links will not
  519. work in the printed version (obviously), and page numbers will not appear in
  520. the electronic version. In case of a discrepancy, the electronic version is
  521. considered the authoritative version of the document.
  522.  
  523. 1.2 How the specification is organized
  524.  
  525. The specification is organized into the following sections:
  526.  
  527. Section 2: An introduction to CSS2
  528.      The introduction includes a brief tutorial on CSS2 and a discussion of
  529.      design principles behind CSS2.
  530. Sections 3 - 20: CSS2 reference manual.
  531.      The bulk of the reference manual consists of the CSS2 language
  532.      reference. This reference defines what may go into a CSS2 style sheet
  533.      (syntax, properties, property values) and how user agents must
  534.      interpret these style sheets in order to claim conformance.
  535. Appendixes:
  536.      Appendixes contain information about a sample style sheet for HTML 4.0,
  537.      changes from CSS1 , implementation and performance notes, the grammar
  538.      of CSS2, a list of normative and informative references, and three
  539.      indexes: one for properties, one for descriptors, and one general
  540.      index.
  541.  
  542. 1.3 Conventions
  543.  
  544. 1.3.1 Document language elements and attributes
  545.  
  546.    * CSS property, descriptor, and pseudo-class names are delimited by
  547.      single quotes.
  548.    * CSS values are delimited by single quotes.
  549.    * Document language element names are in uppercase letters.
  550.    * Document language attribute names are in lowercase letters and
  551.      delimited by double quotes.
  552.  
  553. 1.3.2 CSS property definitions
  554.  
  555. Each CSS property definition begins with a summary of key information that
  556. resembles the following:
  557.  
  558. 'property-name'
  559.      Value:         legal values & syntax
  560.      Initial:       initial value
  561.      Applies to:    elements this property applies to
  562.      Inherited:     whether the property is inherited
  563.      Percentages:   how percentage values are interpreted
  564.      Media:         which media groups the property applies to
  565.  
  566. Value
  567.  
  568. This part specifies the set of valid values for the property. Value types
  569. may be designated in several ways:
  570.  
  571.   1. keyword values (e.g., auto, disc, etc.)
  572.   2. basic data types, which appear between "<" and ">" (e.g., <length>,
  573.      <percentage>, etc.). In the electronic version of the document, each
  574.      instance of a basic data type links to its definition.
  575.   3. types that have the same range of values as a property bearing the same
  576.      name (e.g., <'border-width'> <'background-attachment'>, etc.). In this
  577.      case, the type name is the property name (complete with quotes) between
  578.      "<" and ">" (e.g., <'border-width'>). In the electronic version of the
  579.      document, each instance of this type of non-terminal links to the
  580.      corresponding property definition.
  581.   4. non-terminals that do not share the same name as a property. In this
  582.      case, the non-terminal name appears between "<" and ">", as in
  583.      <border-width>. Notice the distinction between <border-width> and
  584.      <'border-width'>; the latter is defined in terms of the former. The
  585.      definition of a non-terminal is located near its first appearance in
  586.      the specification. In the electronic version of the document, each
  587.      instance of this type of value links to the corresponding value
  588.      definition.
  589.  
  590. Other words in these definitions are keywords that must appear literally,
  591. without quotes (e.g., red). The slash (/) and the comma (,) must also appear
  592. literally.
  593.  
  594. Values may be arranged as follows:
  595.  
  596.    * Several juxtaposed words mean that all of them must occur, in the given
  597.      order.
  598.    * A bar (|) separates two or more alternatives: exactly one of them must
  599.      occur.
  600.    * A double bar (||) separates two or more options: one or more of them
  601.      must occur, in any order.
  602.    * Brackets ([ ]) are for grouping.
  603.  
  604. Juxtaposition is stronger than the double bar, and the double bar is
  605. stronger than the bar. Thus, the following lines are equivalent:
  606.  
  607.     a b   |   c || d e
  608.   [ a b ] | [ c || [ d e ]]
  609.  
  610. Every type, keyword, or bracketed group may be followed by one of the
  611. following modifiers:
  612.  
  613.    * An asterisk (*) indicates that the preceding type, word, or group
  614.      occurs zero or more times.
  615.    * A plus (+) indicates that the preceding type, word, or group occurs one
  616.      or more times.
  617.    * A question mark (?) indicates that the preceding type, word, or group
  618.      is optional.
  619.    * A pair of numbers in curly braces ({A,B}) indicates that the preceding
  620.      type, word, or group occurs at least A and at most B times.
  621.  
  622. The following examples illustrate different value types:
  623.  
  624.      Value: N | NW | NE
  625.      Value: [ <length> | thick | thin ]{1,4}
  626.      Value: [<family-name> , ]* <family-name>
  627.      Value: <uri>? <color> [ / <color> ]?
  628.      Value: <uri> || <color>
  629.  
  630. Initial
  631.  
  632. This part specifies the property's initial value. If the property is
  633. inherited, this is the value that is given to the root element of the
  634. document tree. Please consult the section on the cascade for information
  635. about the interaction between style sheet-specified, inherited, and initial
  636. values.
  637.  
  638. Applies to
  639.  
  640. This part lists the elements to which the property applies. All elements are
  641. considered to have all properties, but some properties have no rendering
  642. effect on some types of elements. For example, 'white-space' only affects
  643. block-level elements.
  644.  
  645. Inherited
  646.  
  647. This part indicates whether the value of the property is inherited from an
  648. ancestor element. Please consult the section on the cascade for information
  649. about the interaction between style sheet-specified, inherited, and initial
  650. values.
  651.  
  652. Percentage values
  653.  
  654. This part indicates how percentages should be interpreted, if they occur in
  655. the value of the property. If "N/A" appears here, it means that the property
  656. does not accept percentages as values.
  657.  
  658. Media groups
  659.  
  660. This part indicates the media groups to which the property applies. The
  661. conformance conditions state that user agents must support this property if
  662. they support rendering to the media types included in these media groups.
  663.  
  664. 1.3.3 Shorthand properties
  665.  
  666. Some properties are shorthand properties, meaning they allow authors to
  667. specify the values of several properties with a single property.
  668.  
  669. For instance, the 'font' property is a shorthand property for setting
  670. 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', and
  671. 'font-family' all at once.
  672.  
  673. When values are omitted from a shorthand form, each "missing" property is
  674. assigned its initial value (see the section on the cascade).
  675.  
  676. Example(s):
  677.  
  678. The multiple style rules of this example:
  679.  
  680. H1 {
  681.   font-weight: bold;
  682.   font-size: 12pt;
  683.   line-height: 14pt;
  684.   font-family: Helvetica;
  685.   font-variant: normal;
  686.   font-style: normal;
  687.   font-stretch: normal;
  688.   font-size-adjust: none
  689. }
  690.  
  691. may be rewritten with a single shorthand property:
  692.  
  693. H1 { font: bold 12pt/14pt Helvetica }
  694.  
  695. In this example, 'font-variant', 'font-stretch', 'font-size-adjust', and
  696. 'font-style' take their initial values.
  697.  
  698. 1.3.4 Notes and examples
  699.  
  700. All examples that illustrate illegal usage are clearly marked as "ILLEGAL
  701. EXAMPLE".
  702.  
  703. All HTML examples conform to the HTML 4.0 strict DTD (defined in [HTML40])
  704. unless otherwise indicated by a document type declaration.
  705.  
  706. All notes are informative only.
  707.  
  708. Examples and notes are marked within the source HTML for the specification
  709. and CSS1 user agents will render them specially.
  710.  
  711. 1.3.5 Images and long descriptions
  712.  
  713. Most images in the electronic version of this specification are accompanied
  714. by "long descriptions" of what they represent. A link to the long
  715. description is denoted by a "[D]" to the right of the image.
  716.  
  717. Images and long descriptions are informative only.
  718.  
  719. 1.4 Acknowledgments
  720.  
  721. This specification is the product of the W3C Working Group on Cascading
  722. Style Sheets and Formatting Properties. In addition to the editors of this
  723. specification, the members of the Working Group are: Brad Chase (Bitstream),
  724. Chris Wilson (Microsoft), Daniel Glazman (ElectricitÈ de France), Dave
  725. Raggett (W3C/HP), Ed Tecot (Microsoft), Jared Sorensen (Novell), Lauren Wood
  726. (SoftQuad), Laurie Anna Kaplan (Microsoft), Mike Wexler (Adobe), Murray
  727. Maloney (Grif), Powell Smith (IBM), Robert Stevahn (HP), Steve Byrne
  728. (JavaSoft), Steven Pemberton (CWI), Thom Phillabaum (Netscape), Douglas Rand
  729. (Silicon Graphics), Robert Pernett (Lotus), Dwayne Dicks (SoftQuad), and Sho
  730. Kuwamoto (Macromedia). We thank them for their continued efforts.
  731.  
  732. A number of invited experts to the Working Group have contributed: George
  733. Kersher, Glenn Rippel (Bitstream), Jeff Veen (HotWired), Markku T. Hakkinen
  734. (The Productivity Works), Martin D¸rst (W3C, formerly Universit‰t Z¸rich),
  735. Roy Platon (RAL), Todd Fahrner (Verso), Tim Boland (NIST), Eric Meyer (Case
  736. Western Reserve University), and Vincent Quint (W3C).
  737.  
  738. The section on Web Fonts was strongly shaped by Brad Chase (Bitstream) David
  739. Meltzer (Microsoft Typography) and Steve Zilles (Adobe). The following
  740. people have also contributed in various ways to the section pertaining to
  741. fonts: Alex Beamon (Apple), Ashok Saxena (Adobe), Ben Bauermeister (HP),
  742. Dave Raggett (W3C/HP), David Opstad (Apple), David Goldsmith (Apple), Ed
  743. Tecot (Microsoft), Erik van Blokland (LettError), FranÁois Yergeau (Alis),
  744. Gavin Nicol (Inso), Herbert van Zijl (Elsevier), Liam Quin, Misha Wolf
  745. (Reuters), Paul Haeberli (SGI), and the late Phil Karlton (Netscape).
  746.  
  747. The section on Paged Media was in large parts authored by Robert Stevahn
  748. (HP) and Stephen Waters (Microsoft).
  749.  
  750. Robert Stevahn (HP), Scott Furman (Netscape), and Scott Isaacs (Microsoft)
  751. were key contributors to CSS Positioning.
  752.  
  753. Mike Wexler (Adobe) was the editor of the interim working draft, which
  754. described many of the new features of CSS2.
  755.  
  756. T.V. Raman (Adobe) made pivotal contributions towards Aural Cascading Style
  757. Sheets (ACSS) and the concepts of aural presentation based on his work on
  758. AsTeR (Audio System For Technical Readings). He contributed an initial draft
  759. of the ACSS specification that shaped the current specification. Values for
  760. aural properties in the HTML 4.0 sample style sheet are of his devising; he
  761. currently uses them on a daily basis on his audio desktop in conjunction
  762. with Emacspeak and the Emacs W3 browser (authored by William Perry, who also
  763. implemented the aural extensions on the W3 side of the fence).
  764.  
  765. Todd Fahrner (Verso) researched contemporary and historical browsers to
  766. develop the sample style sheet in the appendix.
  767.  
  768. Thanks to Jan K‰rrman, author of html2ps for helping so much in creating the
  769. PostScript version of the specification.
  770.  
  771. Through electronic and physical encounters, the following people have
  772. contributed to the development of CSS2: Alan Borning, Robert Cailliau, Liz
  773. Castro, James Clark, Dan Connolly, Donna Converse, Daniel Dardailler, Al
  774. Gilman, Daniel Greene, Scott Isaacs, Geir Ivars¯y, Vincent Mallet, Kim
  775. Marriott, Brian Michalowski, Lou Montulli, Henrik Frystyk Nielsen, Jacob
  776. Nielsen, Eva von Pepel, William Perry, David Siegel, Peter Stuckey, and
  777. Jason White.
  778.  
  779. The discussions on www-style@w3.org have been influential in many key issues
  780. for CSS. Especially, we would like to thank Bjorn Backlund, Todd Fahrner,
  781. Lars Marius Garshol, Sue Jordan, Ian Hickson, Susan Lesch, Andrew Marshall,
  782. MegaZone, Eric Meyer, Russell O'Connor, David Perrell, Liam Quinn, Jon
  783. Seymour, Neil St. Laurent, Taylor, Brian Wilson, and Chris Wilson for their
  784. participation.
  785.  
  786. Many thanks to the Web Accessibility Initiative Protocols and Formats
  787. Technical Review Working Group (WAI PF) for helping to improve the
  788. accessibility of CSS2.
  789.  
  790. Many thanks to Philippe Le HÈgaret, whose CSS validator helped ensure
  791. correct examples and a sensible grammar.
  792.  
  793. Special thanks to Arnaud Le Hors, whose engineering contributions made this
  794. document work.
  795.  
  796. Adam Costello improved this specification by performing a detailed review.
  797.  
  798. Lastly, thanks to Tim Berners-Lee without whom none of this would have been
  799. possible.
  800.  
  801. 1.5 Copyright Notice
  802.  
  803. Copyright © 1997 World Wide Web Consortium, (Massachusetts Institute of
  804. Technology, Institut National de Recherche en Informatique et en
  805. Automatique, Keio University). All Rights Reserved.
  806.  
  807. Documents on the W3C site are provided by the copyright holders under the
  808. following license. By obtaining, using and/or copying this document, or the
  809. W3C document from which this statement is linked, you agree that you have
  810. read, understood, and will comply with the following terms and conditions:
  811.  
  812. Permission to use, copy, and distribute the contents of this document, or
  813. the W3C document from which this statement is linked, in any medium for any
  814. purpose and without fee or royalty is hereby granted, provided that you
  815. include the following on ALL copies of the document, or portions thereof,
  816. that you use:
  817.  
  818.   1. A link or URI to the original W3C document.
  819.   2. The pre-existing copyright notice of the original author, if it doesn't
  820.      exist, a notice of the form: "Copyright © World Wide Web Consortium,
  821.      (Massachusetts Institute of Technology, Institut National de Recherche
  822.      en Informatique et en Automatique, Keio University). All Rights
  823.      Reserved."
  824.   3. If it exists, the STATUS of the W3C document.
  825.  
  826. When space permits, inclusion of the full text of this NOTICE should be
  827. provided. In addition, credit shall be attributed to the copyright holders
  828. for any software, documents, or other items or products that you create
  829. pursuant to the implementation of the contents of this document, or any
  830. portion thereof.
  831.  
  832. No right to create modifications or derivatives is granted pursuant to this
  833. license.
  834.  
  835. THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
  836. REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT
  837. LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
  838. NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE
  839. FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT
  840. INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
  841.  
  842. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
  843. CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE
  844. PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.
  845.  
  846. The name and trademarks of copyright holders may NOT be used in advertising
  847. or publicity pertaining to this document or its contents without specific,
  848. written prior permission. Title to copyright in this document will at all
  849. times remain with copyright holders.
  850.  
  851.   ------------------------------------------------------------------------
  852.   ------------------------------------------------------------------------
  853.  
  854.                            2 Introduction to CSS2
  855.  
  856. Contents
  857.  
  858.    * 2.1 A brief CSS2 tutorial for HTML
  859.    * 2.2 A brief CSS2 tutorial for XML
  860.    * 2.3 The CSS2 processing model
  861.         o 2.3.1 The canvas
  862.         o 2.3.2 CSS2 addressing model
  863.    * 2.4 CSS design principles
  864.  
  865. 2.1 A brief CSS2 tutorial for HTML
  866.  
  867. In this tutorial, we show how easy it can be to design simple style sheets.
  868. For this tutorial, you will need to know a little HTML (see [HTML40]) and
  869. some basic desktop publishing terminology.
  870.  
  871. We begin with a small HTML document:
  872.  
  873. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  874. <HTML>
  875.   <HEAD>
  876.   <TITLE>Bach's home page</TITLE>
  877.   </HEAD>
  878.   <BODY>
  879.     <H1>Bach's home page</H1>
  880.     <P>Johann Sebastian Bach was a prolific composer.
  881.   </BODY>
  882. </HTML>
  883.  
  884. To set the text color of the H1 elements to blue, you can write the
  885. following CSS rule:
  886.  
  887.   H1 { color: blue }
  888.  
  889. A CSS rule consists of two main parts: selector ('H1') and declaration
  890. ('color: blue'). The declaration has two parts: property ('color') and value
  891. ('blue'). While the example above tries to influence only one of the
  892. properties needed for rendering an HTML document, it qualifies as a style
  893. sheet on its own. Combined with other style sheets (one fundamental feature
  894. of CSS is that style sheets are combined) it will determine the final
  895. presentation of the document.
  896.  
  897. The HTML 4.0 specification defines how style sheet rules may be specified
  898. for HTML documents: either within the HTML document, or via an external
  899. style sheet. To put the style sheet into the document, use the STYLE
  900. element:
  901.  
  902. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  903. <HTML>
  904.   <HEAD>
  905.   <TITLE>Bach's home page</TITLE>
  906.   <STYLE type="text/css">
  907.     H1 { color: blue }
  908.   </STYLE>
  909.   </HEAD>
  910.   <BODY>
  911.     <H1>Bach's home page</H1>
  912.     <P>Johann Sebastian Bach was a prolific composer.
  913.   </BODY>
  914. </HTML>
  915.  
  916. For maximum flexibility, we recommend that authors specify external style
  917. sheets; they may be changed without modifying the source HTML document, and
  918. they may be shared among several documents. To link to an external style
  919. sheet, you can use the LINK element:
  920.  
  921. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  922. <HTML>
  923.   <HEAD>
  924.   <TITLE>Bach's home page</TITLE>
  925.   <LINK rel="stylesheet" href="bach.css" type="text/css">
  926.   </HEAD>
  927.   <BODY>
  928.     <H1>Bach's home page</H1>
  929.     <P>Johann Sebastian Bach was a prolific composer.
  930.   </BODY>
  931. </HTML>
  932.  
  933. The LINK element specifies:
  934.  
  935.    * the type of link: to a "stylesheet".
  936.    * the location of the style sheet via the "ref" attribute.
  937.    * the type of style sheet being linked: "text/css".
  938.  
  939. To show the close relationship between a style sheet and the structured
  940. markup, we continue to use the STYLE element in this tutorial. Let's add
  941. more colors:
  942.  
  943. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  944. <HTML>
  945.   <HEAD>
  946.   <TITLE>Bach's home page</TITLE>
  947.   <STYLE type="text/css">
  948.     BODY { color: red }
  949.     H1 { color: blue }
  950.   </STYLE>
  951.   </HEAD>
  952.   <BODY>
  953.     <H1>Bach's home page</H1>
  954.     <P>Johann Sebastian Bach was a prolific composer.
  955.   </BODY>
  956. </HTML>
  957.  
  958. The style sheet now contains two rules: the first one sets the color of the
  959. BODY element to 'red', while the second one sets the color of the H1 element
  960. to 'blue'. Since no color value has been specified for the P element, it
  961. will inherit the color from its parent element, namely BODY. The H1 element
  962. is also a child element of BODY but the second rule overrides the inherited
  963. value. In CSS there are often such conflicts between different values, and
  964. this specification describes how to resolve them.
  965.  
  966. CSS2 has more than 100 different properties, including 'color'. Let's look
  967. at some of the others:
  968.  
  969. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  970. <HTML>
  971.   <HEAD>
  972.   <TITLE>Bach's home page</TITLE>
  973.   <STYLE type="text/css">
  974.     BODY {
  975.       font-family: "Gill Sans", sans-serif;
  976.       font-size: 12pt;
  977.       margin: 3em;
  978.     }
  979.   </STYLE>
  980.   </HEAD>
  981.   <BODY>
  982.     <H1>Bach's home page</H1>
  983.     <P>Johann Sebastian Bach was a prolific composer.
  984.   </BODY>
  985. </HTML>
  986.  
  987. The first thing to notice is that several declarations are grouped within a
  988. block enclosed by curly braces ({...}), and separated by semicolons, though
  989. the last declaration may also be followed by a semicolon.
  990.  
  991. The first declaration on the BODY element sets the font family to "Gill
  992. Sans". If that font isn't available, the user agent (often referred to as a
  993. "browser") will use the 'sans-serif' font family which is one of five
  994. generic font families which all users agents know. Child elements of BODY
  995. will inherit the value of the 'font-family' property.
  996.  
  997. The second declaration sets the font size of the BODY element to 12 points.
  998. The "point" unit is commonly used in print-based typography to indicate font
  999. sizes and other length values. It's an example of an absolute unit which
  1000. does not scale relative to the environment.
  1001.  
  1002. The third declaration uses a relative unit which scales with regard to its
  1003. surroundings. The "em" unit refers to the font size of the element. In this
  1004. case the result is that the margins around the BODY element are three times
  1005. wider than the font size.
  1006.  
  1007. 2.2 A brief CSS2 tutorial for XML
  1008.  
  1009. CSS can be used with any structured document format, for example with
  1010. applications of the eXtensible Markup Language [XML10]. In fact, XML depends
  1011. more on style sheets than HTML, since authors can make up their own elements
  1012. that user agents don't know how to display.
  1013.  
  1014. Here is a simple XML fragment:
  1015.  
  1016. <ARTICLE>
  1017.   <HEADLINE>Fredrick the Great meets Bach</HEADLINE>
  1018.   <AUTHOR>Johann Nikolaus Forkel</AUTHOR>
  1019.   <PARA>
  1020.     One evening, just as he was getting his
  1021.     <INSTRUMENT>flute</INSTRUMENT> ready and his
  1022.     musicians were assembled, an officer brought him a list of
  1023.     the strangers who had arrived.
  1024.   </PARA>
  1025. </ARTICLE>
  1026.  
  1027. To display this fragment in a document-like fashion, we must first declare
  1028. which elements are inline-level (i.e., do not cause line breaks) and which
  1029. are block-level (i.e., cause line breaks).
  1030.  
  1031. INSTRUMENT { display: inline }
  1032. ARTICLE, HEADLINE, AUTHOR, PARA { display: block }
  1033.  
  1034. The first rule declares INSTRUMENT to be inline and the second rule, with
  1035. its comma-separated list of selectors, declares all the other elements to be
  1036. block-level.
  1037.  
  1038. One proposal for linking a style sheet to an XML document is to use a
  1039. processing instruction:
  1040.  
  1041. <?XML:stylesheet type="text/css" href="bach.css"?>
  1042. <ARTICLE>
  1043.   <HEADLINE>Fredrick the Great meets Bach</HEADLINE>
  1044.   <AUTHOR>Johann Nikolaus Forkel</AUTHOR>
  1045.   <PARA>
  1046.     One evening, just as he was getting his
  1047.     <INSTRUMENT>flute</INSTRUMENT> ready and his
  1048.     musicians were assembled, an officer brought him a list of
  1049.     the strangers who had arrived.
  1050.   </PARA>
  1051. </ARTICLE>
  1052.  
  1053. A visual user agent could format the above example as:
  1054.  
  1055. [Example rendering]   [D]
  1056.  
  1057. Notice that the word "flute" remains within the paragraph since it is the
  1058. content of the inline element INSTRUMENT.
  1059.  
  1060. Still, the text isn't formatted the way you would expect. For example, the
  1061. headline font size should be larger than then rest of the text, and you may
  1062. want to display the author's name in italic:
  1063.  
  1064. INSTRUMENT { display: inline }
  1065. ARTICLE, HEADLINE, AUTHOR, PARA { display: block }
  1066. HEADLINE { font-size: 1.3em }
  1067. AUTHOR { font-style: italic }
  1068. ARTICLE, HEADLINE, AUTHOR, PARA { margin: 0.5em }
  1069.  
  1070. A visual user agent could format the above example as:
  1071.  
  1072. [Example rendering]   [D]
  1073.  
  1074. Adding more rules to the style sheet will allow you to further improve the
  1075. presentation of the document.
  1076.  
  1077. 2.3 The CSS2 processing model
  1078.  
  1079. This section presents one possible model of how user agents that support CSS
  1080. work. This is only a conceptual model; real implementations may vary.
  1081.  
  1082. In this model, a user agent processes a source by going through the
  1083. following steps:
  1084.  
  1085.   1. Parse the source document and create a document tree.
  1086.   2. Identify the target media type.
  1087.   3. Retrieve all style sheets associated with the document that are
  1088.      specified for the target media type.
  1089.   4. Annotate every element of the document tree by assigning a single value
  1090.      to every property that is applicable to the target media type.
  1091.      Properties are assigned values according to the mechanisms described in
  1092.      the section on cascading and inheritance.
  1093.  
  1094.      Part of the calculation of values depends on the formatting algorithm
  1095.      appropriate for the target media type. For example, if the target
  1096.      medium is the screen, user agents apply the visual formatting model. If
  1097.      the destination medium is the printed page, user agents apply the page
  1098.      model. If the destination medium is an aural rendering device (e.g.,
  1099.      speech synthesizer), user agents apply the aural rendering model.
  1100.   5. From the annotated document tree, generate a formatting structure.
  1101.      Often, the formatting structure closely resembles the document tree,
  1102.      but it may also differ significantly, notably when authors make use of
  1103.      pseudo-elements and generated content. First, the formatting structure
  1104.      need not be "tree-shaped" at all -- the nature of the structure depends
  1105.      on the implementation. Second, the formatting structure may contain
  1106.      more or less information than the document tree. For instance, if an
  1107.      element in the document tree has a value of 'none' for the 'display'
  1108.      property, that element will generate nothing in the formatting
  1109.      structure. A list element, on the other hand, may generate more
  1110.      information in the formatting structure: the list element's content and
  1111.      list style information (e.g., a bullet image).
  1112.  
  1113.      Note that the CSS user agent does not alter the document tree during
  1114.      this phase. In particular, content generated due to style sheets is not
  1115.      fed back to the document language processor (e.g., for reparsing).
  1116.   6. Transfer the formatting structure to the target medium (e.g., print the
  1117.      results, display them on the screen, render them as speech, etc.).
  1118.  
  1119. Step 1 lies outside the scope of this specification (see, for example,
  1120. [DOM]).
  1121.  
  1122. Steps 2-5 are addressed by the bulk of this specification.
  1123.  
  1124. Step 6 lies outside the scope of this specification.
  1125.  
  1126. 2.3.1 The canvas
  1127.  
  1128. For all media, the term canvas describes "the space where the formatting
  1129. structure is rendered." The canvas is infinite for each dimension of the
  1130. space, but rendering generally occurs within a finite region of the canvas,
  1131. established by the user agent according to the target medium. For instance,
  1132. user agents rendering to a screen generally impose a minimum width and
  1133. choose an initial width based on the dimensions of the viewport. User agents
  1134. rendering to a page generally impose width and height constraints. Aural
  1135. user agents may impose limits in audio space, but not in time.
  1136.  
  1137. 2.3.2 CSS2 addressing model
  1138.  
  1139. CSS2 selectors and properties allow style sheets to refer to the following
  1140. parts of a document or user agent:
  1141.  
  1142.    * Elements in the document tree and certain relationships between them
  1143.      (see the section on selectors).
  1144.    * Attributes of elements in the document tree, and values of those
  1145.      attributes (see the section on attribute selectors).
  1146.    * Some parts of element content (see the :first-line and :first-letter
  1147.      pseudo-elements.
  1148.    * Elements of the document tree when they are in a certain state (see the
  1149.      section on pseudo-classes).
  1150.    * Some aspects of the canvas where the document will be rendered.
  1151.    * Some system information (see the section on user interface).
  1152.  
  1153. 2.4 CSS design principles
  1154.  
  1155. CSS2, as CSS1 before it, is based on a set of design principles:
  1156.  
  1157.    * Forward and backward compatibility. CSS2 user agents will be able to
  1158.      understand CSS1 style sheets. CSS1 user agents will be able to read
  1159.      CSS2 style sheets and discard parts they don't understand. Also, user
  1160.      agents with no CSS support will be able to display style-enhanced
  1161.      documents. Of course, the stylistic enhancements made possible by CSS
  1162.      will not be rendered, but all content will be presented.
  1163.  
  1164.    * Complementary to structured documents. Style sheets complement
  1165.      structured documents (e.g., HTML and XML applications), providing
  1166.      stylistic information for the marked-up text. It should be easy to
  1167.      change the style sheet with little or no impact on the markup.
  1168.  
  1169.    * Vendor, platform, and device independence. Style sheets enable
  1170.      documents to remain vendor, platform, and device independent. Style
  1171.      sheets themselves are also vendor and platform independent, but CSS2
  1172.      allows you to target a style sheet for a group of devices (e.g.,
  1173.      printers).
  1174.  
  1175.    * Maintainability. By pointing to style sheets from documents, webmasters
  1176.      can simplify site maintenance and retain consistent look and feel
  1177.      throughout the site. For example, if the organization's background
  1178.      color changes, only one file needs to be changed.
  1179.  
  1180.    * Simplicity. CSS2 is more complex than CSS1, but it remains a simple
  1181.      style language which is human readable and writable. The CSS properties
  1182.      are kept independent of each other to the largest extent possible and
  1183.      there is generally only one way to achieve a certain effect.
  1184.  
  1185.    * Network performance. CSS provides for compact encodings of how to
  1186.      present content. Compared to images or audio files, which are often
  1187.      used by authors to achieve certain rendering effects, style sheets most
  1188.      often decrease the content size. Also, fewer network connections have
  1189.      to be opened which further increases network performance.
  1190.  
  1191.    * Flexibility. CSS can be applied to content in several ways. The key
  1192.      feature is the ability to cascade style information specified in the
  1193.      default (user agent) style sheet, user style sheets, linked style
  1194.      sheets, the document head, and in attributes for the elements forming
  1195.      the document body.
  1196.  
  1197.    * Richness. Providing authors with a rich set of rendering effects
  1198.      increases the richness of the Web as a medium of expression. Designers
  1199.      have been longing for functionality commonly found in desktop
  1200.      publishing and slide-show applications. Some of the requested rendering
  1201.      effects conflict with device independence, but CSS2 goes a long way
  1202.      toward granting designers their requests.
  1203.  
  1204.    * Alternative language bindings. The set of CSS properties described in
  1205.      this specification form a consistent formatting model for visual and
  1206.      aural presentations. This formatting model can be accessed through the
  1207.      CSS language, but bindings to other languages are also possible. For
  1208.      example, a JavaScript program may dynamically change the value of a
  1209.      certain element's 'color' property.
  1210.  
  1211.    * Accessibility. Several CSS features will make the Web more accessible
  1212.      to users with disabilities:
  1213.  
  1214.         o Properties to control font appearance allow authors to eliminate
  1215.           inaccessible bit-mapped text images.
  1216.         o Positioning properties allow authors to eliminate mark-up tricks
  1217.           (e.g., invisible images) to force layout.
  1218.         o The semantics of !important rules mean that users with particular
  1219.           presentation requirements can override the author's style sheets.
  1220.         o The new 'inherit' value for all properties improves cascading
  1221.           generality and allows for easier and more consistent style tuning.
  1222.         o Improved media support, including media groups and the braille,
  1223.           embossed, and tty media types, will allow users and authors to
  1224.           tailor pages to those devices.
  1225.         o Aural properties give control over voice and audio output.
  1226.         o The attribute selectors, 'attr()' function, and 'content' property
  1227.           give access to alternate content.
  1228.         o Counters and section/paragraph numbering can improve document
  1229.           navigability and save on indenting spacing (important for braille
  1230.           devices). The 'word-spacing' and 'text-indent' properties also
  1231.           eliminate the need for extra whitespace in the document.
  1232.  
  1233.      Note. For more information about designing accessible documents using
  1234.      CSS and HTML, please consult [WAI-PAGEAUTH].
  1235.  
  1236.   ------------------------------------------------------------------------
  1237.   ------------------------------------------------------------------------
  1238.  
  1239.                3 Conformance: Requirements and Recommendations
  1240.  
  1241. Contents
  1242.  
  1243.    * 3.1 Definitions
  1244.    * 3.2 Conformance
  1245.    * 3.3 Error conditions
  1246.    * 3.4 The text/css content type
  1247.  
  1248. 3.1 Definitions
  1249.  
  1250. In this section, we begin the formal specification of CSS2, starting with
  1251. the contract between authors, users, and implementers.
  1252.  
  1253. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  1254. "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
  1255. document are to be interpreted as described in RFC 2119 (see [RFC2119]).
  1256. However, for readability, these words do not appear in all uppercase letters
  1257. in this specification.
  1258.  
  1259. At times, this specification recommends good practice for authors and user
  1260. agents. These recommendations are not normative and conformance with this
  1261. specification does not depend on their realization. These recommendations
  1262. contain the expression "We recommend ...", "This specification recommends
  1263. ...", or some similar wording.
  1264.  
  1265. Style sheet
  1266.      A set of statements that specify presentation of a document.
  1267.  
  1268.      Style sheets may have three different origins: author, user, and user
  1269.      agent. The interaction of these sources is described in the section on
  1270.      cascading and inheritance.
  1271. Valid style sheet
  1272.      The validity of a style sheet depends on the level of CSS used for the
  1273.      style sheet. All valid CSS1 style sheets are valid CSS2 style sheets.
  1274.      However, some changes from CSS1 mean that a few CSS1 style sheets will
  1275.      have slightly different semantics in CSS2.
  1276.  
  1277.      A valid CSS2 style sheet must be written according to the grammar of
  1278.      CSS2. Furthermore, it must contain only at-rules, property names, and
  1279.      property values defined in this specification. An illegal (invalid)
  1280.      at-rule, property name, or property value is one that is not valid.
  1281. Source document
  1282.      The document to which one or more style sheets refer. This is encoded
  1283.      in some language that represents the document as a tree of elements.
  1284.      Each element consists of a name that identifies the type of element,
  1285.      optionally a number of attributes, and a (possibly empty) content.
  1286. Document language
  1287.      The encoding language of the source document (e.g., HTML or an XML
  1288.      application).
  1289. Element
  1290.      (An SGML term, see [ISO8879].) The primary syntactic constructs of the
  1291.      document language. Most CSS style sheet rules use the names of these
  1292.      elements (such as "P", "TABLE", and "OL" for HTML) to specify rendering
  1293.      information for them.
  1294. Replaced element
  1295.      An element for which the CSS formatter knows only the intrinsic
  1296.      dimensions. In HTML, IMG, INPUT, TEXTAREA, SELECT, and OBJECT elements
  1297.      can be examples of replaced elements. For example, the content of the
  1298.      IMG element is often replaced by the image that the "src" attribute
  1299.      designates. CSS does not define how the intrinsic dimensions are found.
  1300. Intrinsic dimensions
  1301.      The width and height as defined by the element itself, not imposed by
  1302.      the surroundings. In CSS2 it is assumed that all replaced elements --
  1303.      and only replaced elements -- come with intrinsic dimensions.
  1304. Attribute
  1305.      A value associated with an element, consisting of a name, and an
  1306.      associated (textual) value.
  1307. Content
  1308.      The content associated with an element in the source document; not all
  1309.      elements have content in which case they are called empty. The content
  1310.      of an element may include text, and it may include a number of
  1311.      sub-elements, in which case the element is called the parent of those
  1312.      sub-elements.
  1313. Rendered content
  1314.      The content of an element after the rendering that applies to it
  1315.      according to the relevant style sheets has been applied. The rendered
  1316.      content of a replaced element comes from outside the source document.
  1317.      Rendered content may also be alternate text for an element (e.g., the
  1318.      value of the HTML "alt" attribute), and may include items inserted
  1319.      implicitly or explicitly by the style sheet, such as bullets,
  1320.      numbering, etc.
  1321. Document tree
  1322.      The tree of elements encoded in the source document. Each element in
  1323.      this tree has exactly one parent, with the exception of the root
  1324.      element, which has none.
  1325. Child
  1326.      An element A is called the child of element B if an only if B is the
  1327.      parent of A.
  1328. Descendant
  1329.      An element A is called a descendant of an element B, if either (1) A is
  1330.      a child of B, or (2) A is the child of some element C that is a
  1331.      descendant of B.
  1332. Ancestor
  1333.      An element A is called an ancestor of an element B, if and only if B is
  1334.      a descendant of A.
  1335. Sibling
  1336.      An element A is called a sibling of an element B, if and only if B and
  1337.      A share the same parent element. Element A is a preceding sibling if it
  1338.      comes before B in the document tree. Element B is a following sibling
  1339.      if it comes after B in the document tree.
  1340. Preceding element
  1341.      An element A is called a preceding element of an element B, if and only
  1342.      if (1) A is an ancestor of B or (2) A is a preceding sibling of B.
  1343. Following element
  1344.      An element A is called a following element of an element B, if and only
  1345.      if B is a preceding element of A.
  1346. Author
  1347.      An author is a person who writes documents and associated style sheets.
  1348.      An authoring tool generates documents and associated style sheets.
  1349. User
  1350.      A user is a person who interacts with a user agent to view, hear, or
  1351.      otherwise use a document and its associated style sheet. The user may
  1352.      provide a personal style sheet that encodes personal preferences.
  1353. User agent (UA)
  1354.      A user agent is any program that interprets a document written in the
  1355.      document language and applies associated style sheets according to the
  1356.      terms of this specification. A user agent may display a document, read
  1357.      it aloud, cause it to be printed, convert it to another format, etc.
  1358.  
  1359. Here is an example of a source document encoded in HTML:
  1360.  
  1361. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  1362. <HTML>
  1363.   <TITLE>My home page</TITLE>
  1364.   <BODY>
  1365.     <H1>My home page</H1>
  1366.     <P>Welcome to my home page! Let me tell you about my favorite
  1367.                 composers:
  1368.     <UL>
  1369.       <LI> Elvis Costello
  1370.       <LI> Johannes Brahms
  1371.       <LI> Georges Brassens
  1372.     </UL>
  1373.   </BODY>
  1374. </HTML>
  1375.  
  1376. This results in the following tree:
  1377.  
  1378. [Sample document tree]   [D]
  1379.  
  1380. According to the definition of HTML, HEAD elements will be inferred during
  1381. parsing and become part of the document tree even if the HEAD tags are not
  1382. in the document source. Similarly, the parser knows where the P and LIs end,
  1383. even though there are no </P> and </LI> tags in the source.
  1384.  
  1385. 3.2 Conformance
  1386.  
  1387. This section defines conformance with the CSS2 specification only. There may
  1388. be other levels of CSS in the future that may require a user agent to
  1389. implement a different set of features in order to conform.
  1390.  
  1391. In general, the following points must be observed by a user agent claiming
  1392. conformance to this specification:
  1393.  
  1394.   1. It must support one or more of the CSS2 media types.
  1395.   2. For each source document, it must attempt to retrieve all associated
  1396.      style sheets that are appropriate for the supported media types. If it
  1397.      cannot retrieve all associated style sheets (for instance, because of
  1398.      network errors), it must display the document using those it can
  1399.      retrieve.
  1400.   3. It must parse the style sheets according to this specification. In
  1401.      particular, it must recognize all at-rules, blocks, declarations, and
  1402.      selectors (see the grammar of CSS2). If a user agent encounters a
  1403.      property that applies for a supported media type, the user agent must
  1404.      parse the value according to the property definition. This means that
  1405.      the user agent must accept all valid values and must ignore
  1406.      declarations with invalid values. User agents must ignore rules that
  1407.      apply to unsupported media types.
  1408.   4. For each element in a document tree, it must assign a value for every
  1409.      applicable property according to the property's definition and the
  1410.      rules of cascading and inheritance.
  1411.   5. If the source document comes with alternate style sheets (such as with
  1412.      the "alternate" keyword in HTML 4.0 [HTML40]), the UA must allow the
  1413.      user to select one from among these style sheets and apply the selected
  1414.      one.
  1415.  
  1416. Not every user agent must observe every point, however:
  1417.  
  1418.    * A user agent that inputs style sheets must respect points 1 - 3.
  1419.    * An authoring tool is only required to output valid style sheets
  1420.    * A user agent that renders a document with associated style sheets must
  1421.      respect points 1 - 5 and render the document according to the
  1422.      media-specific requirements set forth in this specification. Values may
  1423.      be approximated when required by the user agent.
  1424.  
  1425. The inability of a user agent to implement part of this specification due to
  1426. the limitations of a particular device (e.g., a user agent cannot render
  1427. colors on a monochrome monitor or page) does not imply non-conformance.
  1428.  
  1429. This specification recommends that a user agent allow the user to specify
  1430. user style sheets.
  1431.  
  1432. 3.3 Error conditions
  1433.  
  1434. In general, this document does not specify error handling behavior for user
  1435. agents (e.g., how they behave when they cannot find a resource designated by
  1436. a URI).
  1437.  
  1438. However, user agents must observe the rules for handling parsing errors.
  1439.  
  1440. Since user agents may vary in how they handle error conditions, authors and
  1441. users must not rely on specific error recovery behavior.
  1442.  
  1443. 3.4 The text/css content type
  1444.  
  1445. CSS style sheets that exist in separate files are sent over the Internet as
  1446. a sequence of bytes accompanied by encoding information (see [HTML40],
  1447. chapter 5). The structure of the transmission, termed a message entity, is
  1448. defined by RFC 2045 and RFC 2068 (see [RFC2045] and [RFC2068]). A message
  1449. entity with a content type of "text/css" represents an independent CSS
  1450. document. The "text/css" content type has been registered by RFC 2138
  1451. ([RFC2318]).
  1452.   ------------------------------------------------------------------------
  1453.   ------------------------------------------------------------------------
  1454.  
  1455.                      4 CSS2 syntax and basic data types
  1456.  
  1457. Contents
  1458.  
  1459.    * 4.1 Syntax
  1460.         o 4.1.1 Tokenization
  1461.         o 4.1.2 Keywords
  1462.         o 4.1.3 Characters and case
  1463.         o 4.1.4 Statements
  1464.         o 4.1.5 At-rules
  1465.         o 4.1.6 Blocks
  1466.         o 4.1.7 Rule sets, declaration blocks, and selectors
  1467.         o 4.1.8 Declarations and properties
  1468.         o 4.1.9 Comments
  1469.    * 4.2 Rules for handling parsing errors
  1470.    * 4.3 Values
  1471.         o 4.3.1 Integers and real numbers
  1472.         o 4.3.2 Lengths
  1473.         o 4.3.3 Percentages
  1474.         o 4.3.4 URL + URN = URI
  1475.         o 4.3.5 Counters
  1476.         o 4.3.6 Colors
  1477.         o 4.3.7 Angles
  1478.         o 4.3.8 Times
  1479.         o 4.3.9 Frequencies
  1480.         o 4.3.10 Strings
  1481.    * 4.4 CSS document representation
  1482.         o 4.4.1 Referring to characters not represented in a character
  1483.           encoding
  1484.  
  1485. 4.1 Syntax
  1486.  
  1487. This section describes a grammar (and forward-compatible parsing rules)
  1488. common to any version of CSS (including CSS2). Future versions of CSS will
  1489. adhere to this core syntax, although they may add additional syntactic
  1490. constraints.
  1491.  
  1492. These descriptions are normative. They are also complemented by the
  1493. normative grammar rules presented in Appendix D.
  1494.  
  1495. 4.1.1 Tokenization
  1496.  
  1497. All levels of CSS -- level 1, level 2, and any future levels -- use the same
  1498. core syntax. This allows UAs to parse (though not completely understand)
  1499. style sheets written in levels of CSS that didn't exist at the time the UAs
  1500. were created. Designers can use this feature to create style sheets that
  1501. work with older user agents, while also exercising the possibilities of the
  1502. latest levels of CSS.
  1503.  
  1504. At the lexical level, CSS style sheets consist of a sequence of tokens. The
  1505. list of tokens for CSS2 is as follows. The definitions use Lex-style regular
  1506. expressions. Octal codes refer to ISO 10646 ([ISO10646]). As in Lex, in case
  1507. of multiple matches, the longest match determines the token.
  1508.      Token                         Definition
  1509.  ------------------------------------------------------------------
  1510.  IDENT         {ident}
  1511.  ATKEYWORD     @{ident}
  1512.  STRING        {string}
  1513.  HASH          #{name}
  1514.  NUMBER        {num}
  1515.  PERCENTAGE    {num}%
  1516.  DIMENSION     {num}{ident}
  1517.  
  1518.  URI           url\({w}{string}{w}\)
  1519.                |url\({w}([!#$%&*-~]|{nonascii}|{escape})*{w}\)
  1520.  UNICODE-RANGE U\+[0-9A-F?]{1,6}(-[0-9A-F]{1,6})?
  1521.  CDO           <!--
  1522.  CDC           -->
  1523.  ;             ;
  1524.  {             \{
  1525.  }             \}
  1526.  (             \(
  1527.  )             \)
  1528.  [             \[
  1529.  ]             \]
  1530.  S             [ \t\r\n\f]+
  1531.  COMMENT       \/\*[^*]*\*+([^/][^*]*\*+)*\/
  1532.  FUNCTION      {ident}\(
  1533.  INCLUDES      ~=
  1534.  DASHMATCH     |=
  1535.  DELIM         any other character not matched by the above rules
  1536.  
  1537. The macros in curly braces ({}) above are defined as follows:
  1538.   Macro                      Definition
  1539.  ------------------------------------------------------------
  1540.  ident   {nmstart}{nmchar}*
  1541.  name    {nmchar}+
  1542.  nmstart [a-zA-Z]|{nonascii}|{escape}
  1543.  nonascii[^\0-\177]
  1544.  unicode \\[0-9a-f]{1,6}[ \n\r\t\f]?
  1545.  escape  {unicode}|\\[ -~\200-\4177777]
  1546.  nmchar  [a-z0-9-]|{nonascii}|{escape}
  1547.  num     [0-9]+|[0-9]*\.[0-9]+
  1548.  string  {string1}|{string2}
  1549.  string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
  1550.  string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'
  1551.  nl      \n|\r\n|\r|\f
  1552.  w       [ \t\r\n\f]*
  1553.  
  1554. Below is the core syntax for CSS. The sections that follow describe how to
  1555. use it. Appendix D describes a more restrictive grammar that is closer to
  1556. the CSS level 2 language.
  1557.  
  1558. stylesheet  : [ CDO | CDC | S | statement ]*;
  1559. statement   : ruleset | at-rule;
  1560. at-rule     : ATKEYWORD S* any* [ block | ';' S* ];
  1561. block       : '{' S* [ any | block | ATKEYWORD S* | ';' ]* '}' S*;
  1562. ruleset     : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*;
  1563. selector    : any+;
  1564. declaration : property ':' S* value;
  1565. property    : IDENT S*;
  1566. value       : [ any | block | ATKEYWORD S* ]+;
  1567. any         : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING
  1568.               | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES
  1569.               | FUNCTION | DASHMATCH | '(' any* ')' | '[' any* ']' ] S*;
  1570.  
  1571. COMMENT tokens do not occur in the grammar (to keep it readable), but any
  1572. number of these tokens may appear anywhere between other tokens.
  1573.  
  1574. The token S in the grammar above stands for whitespace. Only the characters
  1575. "space" (Unicode code 32), "tab" (9), "line feed" (10), "carriage return"
  1576. (13), and "form feed" (12) can occur in whitespace. Other space-like
  1577. characters, such as "em-space" (8195) and "ideographic space" (12288), are
  1578. never part of whitespace.
  1579.  
  1580. 4.1.2 Keywords
  1581.  
  1582. Keywords have the form of identifiers. Keywords must not be placed between
  1583. quotes ("..." or '...'). Thus,
  1584.  
  1585. red
  1586.  
  1587. is a keyword, but
  1588.  
  1589. "red"
  1590.  
  1591. is not. (It is a string.) Other illegal examples:
  1592.  
  1593. Illegal example(s):
  1594.  
  1595. width: "auto";
  1596. border: "none";
  1597. font-family: "serif";
  1598. background: "red";
  1599.  
  1600. 4.1.3 Characters and case
  1601.  
  1602. The following rules always hold:
  1603.  
  1604.    * All CSS style sheets are case-insensitive, except for parts that are
  1605.      not under the control of CSS. For example, the case-sensitivity of
  1606.      values of the HTML attributes "id" and "class", of font names, and of
  1607.      URIs lies outside the scope of this specification. Note in particular
  1608.      that element names are case-insensitive in HTML, but case-sensitive in
  1609.      XML.
  1610.    * In CSS2, identifiers (including element names, classes, and IDs in
  1611.      selectors) can contain only the characters [A-Za-z0-9] and ISO 10646
  1612.      characters 161 and higher, plus the hyphen (-); they cannot start with
  1613.      a hyphen or a digit. They can also contain escaped characters and any
  1614.      ISO 10646 character as a numeric code (see next item). For instance,
  1615.      the identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F".
  1616.  
  1617.      Note that Unicode is code-by-code equivalent to ISO 10646 (see
  1618.      [UNICODE] and [ISO10646]).
  1619.    * In CSS2, a backslash (\) character indicates three types of character
  1620.      escapes.
  1621.  
  1622.      First, inside a string, a backslash followed by a newline is ignored
  1623.      (i.e., the string is deemed not to contain either the backslash or the
  1624.      newline).
  1625.  
  1626.      Second, it cancels the meaning of special CSS characters. Any character
  1627.      (except a hexadecimal digit) can be escaped with a backslash to remove
  1628.      its special meaning. For example, "\"" is a string consisting of one
  1629.      double quote. Style sheet preprocessors must not remove these
  1630.      backslashes from a style sheet since that would change the style
  1631.      sheet's meaning.
  1632.  
  1633.      Third, backslash escapes allow authors to refer to characters they
  1634.      can't easily put in a document. In this case, the backslash is followed
  1635.      by at most six hexadecimal digits (0..9A..F), which stand for the ISO
  1636.      10646 ([ISO10646]) character with that number. If a digit or letter
  1637.      follows the hexadecimal number, the end of the number needs to be made
  1638.      clear. There are two ways to do that:
  1639.        1. with a space (or other whitespace character): "\26 B" ("&B")
  1640.        2. by providing exactly 6 hexadecimal digits: "\000026B" ("&B")
  1641.  
  1642.      In fact, these two methods may be combined. Only one whitespace
  1643.      character is ignored after a hexadecimal escape. Note that this means
  1644.      that a "real" space after the escape sequence must itself either be
  1645.      escaped or doubled.
  1646.    * Backslash escapes are always considered to be part of an identifier or
  1647.      a string (i.e., "\7B" is not punctuation, even though "{" is, and "\32"
  1648.      is allowed at the start of a class name, even though "2" is not).
  1649.  
  1650. 4.1.4 Statements
  1651.  
  1652. A CSS style sheet, for any version of CSS, consists of a list of statements
  1653. (see the grammar above). There are two kinds of statements: at-rules and
  1654. rule sets. There may be whitespace around the statements.
  1655.  
  1656. In this specification, the expressions "immediately before" or "immediately
  1657. after" mean with no intervening whitespace or comments.
  1658.  
  1659. 4.1.5 At-rules
  1660.  
  1661. At-rules start with an at-keyword, an '@' character followed immediately by
  1662. an identifier (for example, '@import', '@page').
  1663.  
  1664. An at-rule consists of everything up to and including the next semicolon (;)
  1665. or the next block, whichever comes first. A CSS user agent that encounters
  1666. an unrecognized at-rule must ignore the whole of the at-rule and continue
  1667. parsing after it.
  1668.  
  1669. CSS2 user agents must ignore any '@import' rule that occurs inside a block
  1670. or that doesn't precede all rule sets.
  1671.  
  1672. Illegal example(s):
  1673.  
  1674. Assume, for example, that a CSS2 parser encounters this style sheet:
  1675.  
  1676. @import "subs.css";
  1677. H1 { color: blue }
  1678. @import "list.css";
  1679.  
  1680. The second '@import' is illegal according to CSS2. The CSS2 parser ignores
  1681. the whole at-rule, effectively reducing the style sheet to:
  1682.  
  1683. @import "subs.css";
  1684. H1 { color: blue }
  1685.  
  1686. Illegal example(s):
  1687.  
  1688. In the following example, the second '@import' rule is invalid, since it
  1689. occurs inside a '@media' block.
  1690.  
  1691. @import "subs.css";
  1692. @media print {
  1693.   @import "print-main.css";
  1694.   BODY { font-size: 10pt }
  1695. }
  1696. H1 {color: blue }
  1697.  
  1698. 4.1.6 Blocks
  1699.  
  1700. A block starts with a left curly brace ({) and ends with the matching right
  1701. curly brace (}). In between there may be any characters, except that
  1702. parentheses (( )), brackets ([ ]) and braces ({ }) must always occur in
  1703. matching pairs and may be nested. Single (') and double quotes (") must also
  1704. occur in matching pairs, and characters between them are parsed as a string.
  1705. See Tokenization above for the definition of a string.
  1706.  
  1707. Illegal example(s):
  1708.  
  1709. Here is an example of a block. Note that the right brace between the double
  1710. quotes does not match the opening brace of the block, and that the second
  1711. single quote is an escaped character, and thus doesn't match the first
  1712. single quote:
  1713.  
  1714. { causta: "}" + ({7} * '\'') }
  1715.  
  1716. Note that the above rule is not valid CSS2, but it is still a block as
  1717. defined above.
  1718.  
  1719. 4.1.7 Rule sets, declaration blocks, and selectors
  1720.  
  1721. A rule set (also called "rule") consists of a selector followed by a
  1722. declaration block.
  1723.  
  1724. A declaration-block (also called a {}-block in the following text) starts
  1725. with a left curly brace ({) and ends with the matching right curly brace
  1726. (}). In between there must be a list of zero or more semicolon-separated (;)
  1727. declarations.
  1728.  
  1729. The selector (see also the section on selectors) consists of everything up
  1730. to (but not including) the first left curly brace ({). A selector always
  1731. goes together with a {}-block. When a user agent can't parse the selector
  1732. (i.e., it is not valid CSS2), it must ignore the {}-block as well.
  1733.  
  1734. CSS2 gives a special meaning to the comma (,) in selectors. However, since
  1735. it is not known if the comma may acquire other meanings in future versions
  1736. of CSS, the whole statement should be ignored if there is an error anywhere
  1737. in the selector, even though the rest of the selector may look reasonable in
  1738. CSS2.
  1739.  
  1740. Illegal example(s):
  1741.  
  1742. For example, since the "&" is not a valid token in a CSS2 selector, a CSS2
  1743. user agent must ignore the whole second line, and not set the color of H3 to
  1744. red:
  1745.  
  1746. H1, H2 {color: green }
  1747. H3, H4 & H5 {color: red }
  1748. H6 {color: black }
  1749.  
  1750. Example(s):
  1751.  
  1752. Here is a more complex example. The first two pairs of curly braces are
  1753. inside a string, and do not mark the end of the selector. This is a valid
  1754. CSS2 statement.
  1755.  
  1756. P[example="public class foo\
  1757. {\
  1758.     private int x;\
  1759. \
  1760.     foo(int x) {\
  1761.         this.x = x;\
  1762.     }\
  1763. \
  1764. }"] { color: red }
  1765.  
  1766. 4.1.8 Declarations and properties
  1767.  
  1768. A declaration is either empty or consists of a property, followed by a colon
  1769. (:), followed by a value. Around each of these there may be whitespace.
  1770.  
  1771. Because of the way selectors work, multiple declarations for the same
  1772. selector may be organized into semicolon (;) separated groups.
  1773.  
  1774. Example(s):
  1775.  
  1776. Thus, the following rules:
  1777.  
  1778. H1 { font-weight: bold }
  1779. H1 { font-size: 12pt }
  1780. H1 { line-height: 14pt }
  1781. H1 { font-family: Helvetica }
  1782. H1 { font-variant: normal }
  1783. H1 { font-style: normal }
  1784.  
  1785. are equivalent to:
  1786.  
  1787. H1 {
  1788.   font-weight: bold;
  1789.   font-size: 12pt;
  1790.   line-height: 14pt;
  1791.   font-family: Helvetica;
  1792.   font-variant: normal;
  1793.   font-style: normal
  1794. }
  1795.  
  1796. A property is an identifier. Any character may occur in the value, but
  1797. parentheses ("( )"), brackets ("[ ]"), braces ("{ }"), single quotes (') and
  1798. double quotes (") must come in matching pairs, and semicolons not in strings
  1799. must be escaped. Parentheses, brackets, and braces may be nested. Inside the
  1800. quotes, characters are parsed as a string.
  1801.  
  1802. The syntax of values is specified separately for each property, but in any
  1803. case, values are built from identifiers, strings, numbers, lengths,
  1804. percentages, URIs, colors, angles, times, and frequencies.
  1805.  
  1806. A user agent must ignore a declaration with an invalid property name or an
  1807. invalid value. Every CSS2 property has its own syntactic and semantic
  1808. restrictions on the values it accepts.
  1809.  
  1810. Illegal example(s):
  1811.  
  1812. For example, assume a CSS2 parser encounters this style sheet:
  1813.  
  1814. H1 { color: red; font-style: 12pt }  /* Invalid value: 12pt */
  1815. P { color: blue;  font-vendor: any;  /* Invalid prop.: font-vendor */
  1816.     font-variant: small-caps }
  1817. EM EM { font-style: normal }
  1818.  
  1819. The second declaration on the first line has an invalid value '12pt'. The
  1820. second declaration on the second line contains an undefined property
  1821. 'font-vendor'. The CSS2 parser will ignore these declarations, effectively
  1822. reducing the style sheet to:
  1823.  
  1824. H1 { color: red; }
  1825. P { color: blue;  font-variant: small-caps }
  1826. EM EM { font-style: normal }
  1827.  
  1828. 4.1.9 Comments
  1829.  
  1830. Comments begin with the characters "/*" and end with the characters "*/".
  1831. They may occur anywhere between tokens, and their contents have no influence
  1832. on the rendering. Comments may not be nested.
  1833.  
  1834. CSS also allows the SGML comment delimiters ("<!--" and "-->") in certain
  1835. places, but they do not delimit CSS comments. They are permitted so that
  1836. style rules appearing in an HTML source document (in the STYLE element) may
  1837. be hidden from pre-HTML 3.2 user agents. See the HTML 4.0 specification
  1838. ([HTML40]) for more information.
  1839.  
  1840. 4.2 Rules for handling parsing errors
  1841.  
  1842. In some cases, user agents must ignore part of an illegal style sheet. This
  1843. specification defines ignore to mean that the user agent parses the illegal
  1844. part (in order to find its beginning and end), but otherwise acts as if it
  1845. had not been there.
  1846.  
  1847. To ensure that new properties and new values for existing properties can be
  1848. added in the future, user agents are required to obey the following rules
  1849. when they encounter the following scenarios:
  1850.  
  1851.    * Unknown properties. User agents must ignore a declaration with an
  1852.      unknown property. For example, if the style sheet is:
  1853.  
  1854.      H1 { color: red; rotation: 70minutes }
  1855.  
  1856.      the user agent will treat this as if the style sheet had been
  1857.  
  1858.      H1 { color: red }
  1859.  
  1860.    * Illegal values. User agents must ignore a declaration with an illegal
  1861.      value. For example:
  1862.  
  1863.      IMG { float: left }       /* correct CSS2 */
  1864.      IMG { float: left here }  /* "here" is not a value of 'float' */
  1865.      IMG { background: "red" } /* keywords cannot be quoted in CSS2 */
  1866.      IMG { border-width: 3 }   /* a unit must be specified for length values */
  1867.  
  1868.      A CSS2 parser would honor the first rule and ignore the rest, as if the
  1869.      style sheet had been:
  1870.  
  1871.      IMG { float: left }
  1872.      IMG { }
  1873.      IMG { }
  1874.      IMG { }
  1875.  
  1876.      A user agent conforming to a future CSS specification may accept one or
  1877.      more of the other rules as well.
  1878.  
  1879.    * Invalid at-keywords. User agents must ignore an invalid at-keyword
  1880.      together with everything following it, up to and including the next
  1881.      semicolon (;) or block ({...}), whichever comes first. For example,
  1882.      consider the following:
  1883.  
  1884.      @three-dee {
  1885.        @background-lighting {
  1886.          azimuth: 30deg;
  1887.          elevation: 190deg;
  1888.        }
  1889.        H1 { color: red }
  1890.      }
  1891.      H1 { color: blue }
  1892.  
  1893.      The '@three-dee' at-rule is not part of CSS2. Therefore, the whole
  1894.      at-rule (up to, and including, the third right curly brace) is ignored.
  1895.      A CSS2 user agent ignores it, effectively reducing the style sheet to:
  1896.  
  1897.      H1 { color: blue }
  1898.  
  1899. 4.3 Values
  1900.  
  1901. 4.3.1 Integers and real numbers
  1902.  
  1903. Some value types may have integer values (denoted by <integer>) or real
  1904. number values (denoted by <number>). Real numbers and integers are specified
  1905. in decimal notation only. An <integer> consists of one or more digits "0" to
  1906. "9". A <number> can either be an <integer>, or it can be zero or more digits
  1907. followed by a dot (.) followed by one or more digits. Both integers and real
  1908. numbers may be preceded by a "-" or "+" to indicate the sign.
  1909.  
  1910. Note that many properties that allow an integer or real number as a value
  1911. actually restrict the value to some range, often to a non-negative value.
  1912.  
  1913. 4.3.2 Lengths
  1914.  
  1915. Lengths refer to horizontal or vertical measurements.
  1916.  
  1917. The format of a length value (denoted by <length> in this specification) is
  1918. an optional sign character ('+' or '-', with '+' being the default)
  1919. immediately followed by a <number> (with or without a decimal point)
  1920. immediately followed by a unit identifier (e.g., px, deg, etc.). After the
  1921. '0' length, the unit identifier is optional.
  1922.  
  1923. Some properties allow negative length values, but this may complicate the
  1924. formatting model and there may be implementation-specific limits. If a
  1925. negative length value cannot be supported, it should be converted to the
  1926. nearest value that can be supported.
  1927.  
  1928. There are two types of length units: relative and absolute. Relative length
  1929. units specify a length relative to another length property. Style sheets
  1930. that use relative units will more easily scale from one medium to another
  1931. (e.g., from a computer display to a laser printer).
  1932.  
  1933. Relative units are:
  1934.  
  1935.    * em: the 'font-size' of the relevant font
  1936.    * ex: the 'x-height' of the relevant font
  1937.    * px: pixels, relative to the viewing device
  1938.  
  1939. Example(s):
  1940.  
  1941. H1 { margin: 0.5em }      /* em */
  1942. H1 { margin: 1ex }        /* ex */
  1943. P  { font-size: 12px }    /* px */
  1944.  
  1945. The 'em' unit is equal to the computed value of the 'font-size' property of
  1946. the element on which it is used. The exception is when 'em' occurs in the
  1947. value of the 'font-size' property itself, in which case it refers to the
  1948. font size of the parent element. It may be used for vertical or horizontal
  1949. measurement. (This unit is also sometimes called the quad-width in
  1950. typographic texts.)
  1951.  
  1952. The 'ex' unit is defined by the font's 'x-height'. The x-height is so called
  1953. because it is often equal to the height of the lowercase "x". However, an
  1954. 'ex' is defined even for fonts that don't contain an "x".
  1955.  
  1956. Example(s):
  1957.  
  1958. The rule:
  1959.  
  1960. H1 { line-height: 1.2em }
  1961.  
  1962. means that the line height of H1 elements will be 20% greater than the font
  1963. size of the H1 elements. On the other hand:
  1964.  
  1965. H1 { font-size: 1.2em }
  1966.  
  1967. means that the font-size of H1 elements will be 20% greater than the font
  1968. size inherited by H1 elements.
  1969.  
  1970. When specified for the root of the document tree (e.g., "HTML" in HTML),
  1971. 'em' and 'ex' refer to the property's initial value.
  1972.  
  1973. Pixel units are relative to the resolution of the viewing device, i.e., most
  1974. often a computer display. If the pixel density of the output device is very
  1975. different from that of a typical computer display, the user agent should
  1976. rescale pixel values. It is recommended that the reference pixel be the
  1977. visual angle of one pixel on a device with a pixel density of 90dpi and a
  1978. distance from the reader of an arm's length. For a nominal arm's length of
  1979. 28 inches, the visual angle is therefore about 0.0227 degrees.
  1980.  
  1981. For reading at arm's length, 1px thus corresponds to about 0.28 mm
  1982. (1/90 inch). When printed on a laser printer, meant for reading at a little
  1983. less than arm's length (55 cm, 21 inches), 1px is about 0.21 mm. On a 300
  1984. dots-per-inch (dpi) printer, that may be rounded up to 3 dots (0.25 mm); on
  1985. a 600 dpi printer, it can be rounded to 5 dots.
  1986.  
  1987. The two images below illustrate the effect of viewing distance on the size
  1988. of a pixel and the effect of a device's resolution. In the first image, a
  1989. reading distance of 71 cm (28 inch) results in a px of 0.28 mm, while a
  1990. reading distance of 3.5 m (12 feet) requires a px of 1.4 mm.
  1991.  
  1992. [Showing that pixels must becomelarger if the viewing distance increases]   [D]
  1993.  
  1994. In the second image, an area of 1px by 1px is covered by a single dot in a
  1995. low-resolution device (a computer screen), while the same area is covered by
  1996. 16 dots in a higher resolution device (such as a 400 dpi laser printer).
  1997.  
  1998. [Showing that more device pixels (dots)are needed to cover a 1px by 1px area on a high-resolution device thanon a low-res one]   [D]
  1999.  
  2000. Child elements do not inherit the relative values specified for their
  2001. parent; they (generally) inherit the computed values.
  2002.  
  2003. Example(s):
  2004.  
  2005. In the following rules, the computed 'text-indent' value of H1 elements will
  2006. be 36pt, not 45pt, if H1 is a child of the BODY element.
  2007.  
  2008. BODY {
  2009.   font-size: 12pt;
  2010.   text-indent: 3em;  /* i.e., 36pt */
  2011. }
  2012. H1 { font-size: 15pt }
  2013.  
  2014. Absolute length units are only useful when the physical properties of the
  2015. output medium are known. The absolute units are:
  2016.  
  2017.    * in: inches -- 1 inch is equal to 2.54 centimeters.
  2018.    * cm: centimeters
  2019.    * mm: millimeters
  2020.    * pt: points -- the points used by CSS2 are equal to 1/72th of an inch.
  2021.    * pc: picas -- 1 pica is equal to 12 points.
  2022.  
  2023. Example(s):
  2024.  
  2025. H1 { margin: 0.5in }      /* inches  */
  2026. H2 { line-height: 3cm }   /* centimeters */
  2027. H3 { word-spacing: 4mm }  /* millimeters */
  2028. H4 { font-size: 12pt }    /* points */
  2029. H4 { font-size: 1pc }     /* picas */
  2030.  
  2031. In cases where the specified length cannot be supported, user agents must
  2032. approximate it in the actual value.
  2033.  
  2034. 4.3.3 Percentages
  2035.  
  2036. The format of a percentage value (denoted by <percentage> in this
  2037. specification) is an optional sign character ('+' or '-', with '+' being the
  2038. default) immediately followed by a <number> immediately followed by '%'.
  2039.  
  2040. Percentage values are always relative to another value, for example a
  2041. length. Each property that allows percentages also defines the value to
  2042. which the percentage refers. The value may be that of another property for
  2043. the same element, a property for an ancestor element, or a value of the
  2044. formatting context (e.g., the width of a containing block). When a
  2045. percentage value is set for a property of the root element and the
  2046. percentage is defined as referring to the inherited value of some property,
  2047. the resultant value is the percentage times the initial value of that
  2048. property.
  2049.  
  2050. Example(s):
  2051.  
  2052. Since child elements (generally) inherit the computed values of their
  2053. parent, in the following example, the children of the P element will inherit
  2054. a value of 12pt for 'line-height', not the percentage value (120%):
  2055.  
  2056. P { font-size: 10pt }
  2057. P { line-height: 120% }  /* 120% of 'font-size' */
  2058.  
  2059. 4.3.4 URL + URN = URI
  2060.  
  2061. URLs (Uniform Resource Locators, see [RFC1738] and [RFC1808]) provide the
  2062. address of a resource on the Web. An expected new way of identifying
  2063. resources is called URN (Uniform Resource Name). Together they are called
  2064. URIs (Uniform Resource Identifiers, see [URI]). This specification uses the
  2065. term URI.
  2066.  
  2067. URI values in this specification are denoted by <uri>. The functional
  2068. notation used to designate URIs in property values is "url()", as in:
  2069.  
  2070. Example(s):
  2071.  
  2072. BODY { background: url("http://www.bg.com/pinkish.gif") }
  2073.  
  2074. The format of a URI value is 'url(' followed by optional whitespace followed
  2075. by an optional single quote (') or double quote (") character followed by
  2076. the URI itself, followed by an optional single quote (') or double quote (")
  2077. character followed by optional whitespace followed by ')'. The two quote
  2078. characters must be the same.
  2079.  
  2080. Example(s):
  2081.  
  2082. An example without quotes:
  2083.  
  2084. LI { list-style: url(http://www.redballs.com/redball.png) disc }
  2085.  
  2086. Parentheses, commas, whitespace characters, single quotes (') and double
  2087. quotes (") appearing in a URI must be escaped with a backslash: '\(', '\)',
  2088. '\,'.
  2089.  
  2090. Depending on the type of URI, it might also be possible to write the above
  2091. characters as URI-escapes (where "(" = %28, ")" = %29, etc.) as described in
  2092. [URI].
  2093.  
  2094. In order to create modular style sheets that are not dependent on the
  2095. absolute location of a resource, authors may use relative URIs. Relative
  2096. URIs (as defined in [RFC1808]) are resolved to full URIs using a base URI.
  2097. RFC 1808, section 3, defines the normative algorithm for this process. For
  2098. CSS style sheets, the base URI is that of the style sheet, not that of the
  2099. source document.
  2100.  
  2101. Example(s):
  2102.  
  2103. For example, suppose the following rule:
  2104.  
  2105. BODY { background: url("yellow") }
  2106.  
  2107. is located in a style sheet designated by the URI:
  2108.  
  2109. http://www.myorg.org/style/basic.css
  2110.  
  2111. The background of the source document's BODY will be tiled with whatever
  2112. image is described by the resource designated by the URI
  2113.  
  2114. http://www.myorg.org/style/yellow
  2115.  
  2116. User agents may vary in how they handle URIs that designate unavailable or
  2117. inapplicable resources.
  2118.  
  2119. 4.3.5 Counters
  2120.  
  2121. Counters are denoted by identifiers (see the 'counter-increment' and
  2122. 'counter-reset' properties). To refer to the value of a counter, the
  2123. notation 'counter(<identifier>)' or 'counter(<identifier>,
  2124. <list-style-type>)' is used. The default style is 'decimal'.
  2125.  
  2126. To refer to a sequence of nested counters of the same name, the notation is
  2127. 'counters(<identifier>, <string>)' or 'counters(<identifier>, <string>,
  2128. <list-style-type>)'. See "Nested counters and scope" in the chapter on
  2129. generated content.
  2130.  
  2131. In CSS2, the values of counters can only be referred to from the 'content'
  2132. property. Note that 'none' is a possible <list-style-type>: 'counter(x,
  2133. none)' yields an empty string.
  2134.  
  2135. Example(s):
  2136.  
  2137. Here is a style sheet that numbers paragraphs (P) for each chapter (H1). The
  2138. paragraphs are numbered with roman numerals, followed by a period and a
  2139. space:
  2140.  
  2141. P {counter-increment: par-num}
  2142. H1 {counter-reset: par-num}
  2143. P:before {content: counter(par-num, upper-roman) ". "}
  2144.  
  2145. Counters that are not in the scope of any 'counter-reset', are assumed to
  2146. have been reset to 0 by a 'counter-reset' on the root element.
  2147.  
  2148. 4.3.6 Colors
  2149.  
  2150. A <color> is either a keyword or a numerical RGB specification.
  2151.  
  2152. The list of keyword color names is: aqua, black, blue, fuchsia, gray, green,
  2153. lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.
  2154. These 16 colors are defined in HTML 4.0 ([HTML40]). In addition to these
  2155. color keywords, users may specify keywords that correspond to the colors
  2156. used by certain objects in the user's environment. Please consult the
  2157. section on system colors for more information.
  2158.  
  2159. Example(s):
  2160.  
  2161. BODY {color: black; background: white }
  2162. H1 { color: maroon }
  2163. H2 { color: olive }
  2164.  
  2165. The RGB color model is used in numerical color specifications. These
  2166. examples all specify the same color:
  2167.  
  2168. Example(s):
  2169.  
  2170. EM { color: #f00 }              /* #rgb */
  2171. EM { color: #ff0000 }           /* #rrggbb */
  2172. EM { color: rgb(255,0,0) }      /* integer range 0 - 255 */
  2173. EM { color: rgb(100%, 0%, 0%) } /* float range 0.0% - 100.0% */
  2174.  
  2175. The format of an RGB value in hexadecimal notation is a '#' immediately
  2176. followed by either three or six hexadecimal characters. The three-digit RGB
  2177. notation (#rgb) is converted into six-digit form (#rrggbb) by replicating
  2178. digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This
  2179. ensures that white (#ffffff) can be specified with the short notation (#fff)
  2180. and removes any dependencies on the color depth of the display.
  2181.  
  2182. The format of an RGB value in the functional notation is 'rgb(' followed by
  2183. a comma-separated list of three numerical values (either three integer
  2184. values or three percentage values) followed by ')'. The integer value 255
  2185. corresponds to 100%, and to F or FF in the hexadecimal notation:
  2186. rgb(255,255,255) = rgb(100%,100%,100%) = #FFF. Whitespace characters are
  2187. allowed around the numerical values.
  2188.  
  2189. All RGB colors are specified in the sRGB color space (see [SRGB]). User
  2190. agents may vary in the fidelity with which they represent these colors, but
  2191. using sRGB provides an unambiguous and objectively measurable definition of
  2192. what the color should be, which can be related to international standards
  2193. (see [COLORIMETRY]).
  2194.  
  2195. Conforming user agents may limit their color-displaying efforts to
  2196. performing a gamma-correction on them. sRGB specifies a display gamma of 2.2
  2197. under specified viewing conditions. User agents should adjust the colors
  2198. given in CSS such that, in combination with an output device's "natural"
  2199. display gamma, an effective display gamma of 2.2 is produced. See the
  2200. section on gamma correction for further details. Note that only colors
  2201. specified in CSS are affected; e.g., images are expected to carry their own
  2202. color information.
  2203.  
  2204. Values outside the device gamut should be clipped: the red, green, and blue
  2205. values must be changed to fall within the range supported by the device. For
  2206. a typical CRT monitor, whose device gamut is the same as sRGB, the three
  2207. rules below are equivalent:
  2208.  
  2209. Example(s):
  2210.  
  2211. EM { color: rgb(255,0,0) }       /* integer range 0 - 255 */
  2212. EM { color: rgb(300,0,0) }       /* clipped to rgb(255,0,0) */
  2213. EM { color: rgb(255,-10,0) }     /* clipped to rgb(255,0,0) */
  2214. EM { color: rgb(110%, 0%, 0%) }  /* clipped to rgb(100%,0%,0%) */
  2215.  
  2216. Other devices, such as printers, have different gamuts to sRGB; some colors
  2217. outside the 0..255 sRGB range will be representable (inside the device
  2218. gamut), while other colors inside the 0..255 sRGB range will be outside the
  2219. device gamut and will thus be clipped.
  2220.  
  2221. Note. Although colors can add significant amounts of information to document
  2222. and make them more readable, please consider that certain color combinations
  2223. may cause problems for users with color blindness. If you use a background
  2224. image or set the background color, please adjust foreground colors
  2225. accordingly.
  2226.  
  2227. 4.3.7 Angles
  2228.  
  2229. Angle values (denoted by <angle> in the text) are used with aural style
  2230. sheets.
  2231.  
  2232. Their format is an optional sign character ('+' or '-', with '+' being the
  2233. default) immediately followed by a <number> immediately followed by an angle
  2234. unit identifier.
  2235.  
  2236. Angle unit identifiers are:
  2237.  
  2238.    * deg: degrees
  2239.    * grad: grads
  2240.    * rad: radians
  2241.  
  2242. Angle values may be negative. They should be normalized to the range
  2243. 0-360deg by the user agent. For example, -10deg and 350deg are equivalent.
  2244.  
  2245. For example, a right angle is '90deg' or '100grad' or
  2246. '1.570796326794897rad'.
  2247.  
  2248. 4.3.8 Times
  2249.  
  2250. Time values (denoted by <time> in the text) are used with aural style
  2251. sheets.
  2252.  
  2253. Their format is a <number> immediately followed by a time unit identifier.
  2254.  
  2255. Time unit identifiers are:
  2256.  
  2257.    * ms: milliseconds
  2258.    * s: seconds
  2259.  
  2260. Time values may not be negative.
  2261.  
  2262. 4.3.9 Frequencies
  2263.  
  2264. Frequency values (denoted by <frequency> in the text) are used with aural
  2265. cascading style sheets.
  2266.  
  2267. Their format is a <number> immediately followed by a frequency unit
  2268. identifier.
  2269.  
  2270. Frequency unit identifiers are:
  2271.  
  2272.    * Hz: Hertz
  2273.    * kHz: kilo Hertz
  2274.  
  2275. Frequency values may not be negative.
  2276.  
  2277. For example, 200Hz (or 200hz) is a bass sound, and 6kHz (or 6khz) is a
  2278. treble sound.
  2279.  
  2280. 4.3.10 Strings
  2281.  
  2282. Strings can either be written with double quotes or with single quotes.
  2283. Double quotes cannot occur inside double quotes, unless escaped (as '\"' or
  2284. as '\22'). Analogously for single quotes ("\'" or "\27").
  2285.  
  2286. Example(s):
  2287.  
  2288. "this is a 'string'"
  2289. "this is a \"string\""
  2290. 'this is a "string"'
  2291. 'this is a \'string\''
  2292.  
  2293. A string cannot directly contain a newline. To include a newline in a
  2294. string, use the escape "\A" (hexadecimal A is the line feed character in
  2295. Unicode, but represents the generic notion of "newline" in CSS). See the
  2296. 'content' property for an example.
  2297.  
  2298. It is possible to break strings over several lines, for aesthetic or other
  2299. reasons, but in such a case the newline itself has to be escaped with a
  2300. backslash (\). For instance, the following two selectors are exactly the
  2301. same:
  2302.  
  2303. Example(s):
  2304.  
  2305. A[TITLE="a not s\
  2306. o very long title"] {/*...*/}
  2307. A[TITLE="a not so very long title"] {/*...*/}
  2308.  
  2309. 4.4 CSS document representation
  2310.  
  2311. A CSS style sheet is a sequence of characters from the Universal Character
  2312. Set (see [ISO10646]). For transmission and storage, these characters must be
  2313. encoded by a character encoding that supports the set of characters
  2314. available in US-ASCII (e.g., ISO 8859-x, SHIFT JIS, etc.). For a good
  2315. introduction to character sets and character encodings, please consult the
  2316. HTML 4.0 specification ([HTML40], chapter 5), See also the XML 1.0
  2317. specification ([XML10], sections 2.2 and 4.3.3, and Appendix F.
  2318.  
  2319. When a style sheet is embedded in another document, such as in the STYLE
  2320. element or "style" attribute of HTML, the style sheet shares the character
  2321. encoding of the whole document.
  2322.  
  2323. When a style sheet resides in a separate file, user agents must observe the
  2324. following priorities when determining a document's character encoding (from
  2325. highest priority to lowest):
  2326.  
  2327.   1. An HTTP "charset" parameter in a "Content-Type" field.
  2328.   2. The @charset at-rule.
  2329.   3. Mechanisms of the language of the referencing document (e.g., in HTML,
  2330.      the "charset" attribute of the LINK element).
  2331.  
  2332. At most one @charset rule may appear in an external style sheet -- it must
  2333. not appear in an embedded style sheet -- and it must appear at the very
  2334. start of the document, not preceded by any characters. After "@charset",
  2335. authors specify the name of a character encoding. The name must be a charset
  2336. name as described in the IANA registry (See [IANA]. Also, see [CHARSETS] for
  2337. a complete list of charsets). For example:
  2338.  
  2339. Example(s):
  2340.  
  2341. @charset "ISO-8859-1";
  2342.  
  2343. This specification does not mandate which character encodings a user agent
  2344. must support.
  2345.  
  2346. Note that reliance on the @charset construct theoretically poses a problem
  2347. since there is no a priori information on how it is encoded. In practice,
  2348. however, the encodings in wide use on the Internet are either based on
  2349. ASCII, UTF-16, UCS-4, or (rarely) on EBCDIC. This means that in general, the
  2350. initial byte values of a document enable a user agent to detect the encoding
  2351. family reliably, which provides enough information to decode the @charset
  2352. rule, which in turn determines the exact character encoding.
  2353.  
  2354. 4.4.1 Referring to characters not represented in a character encoding
  2355.  
  2356. A style sheet may have to refer to characters that cannot be represented in
  2357. the current character encoding. These characters must be written as escaped
  2358. references to ISO 10646 characters. These escapes serve the same purpose as
  2359. numeric character references in HTML or XML documents (see [HTML40],
  2360. chapters 5 and 25).
  2361.  
  2362. The character escape mechanism should be used when only a few characters
  2363. must be represented this way. If most of a document requires escaping,
  2364. authors should encode it with a more appropriate encoding (e.g., if the
  2365. document contains a lot of Greek characters, authors might use "ISO-8859-7"
  2366. or "UTF-8").
  2367.  
  2368. Intermediate processors using a different character encoding may translate
  2369. these escaped sequences into byte sequences of that encoding. Intermediate
  2370. processors must not, on the other hand, alter escape sequences that cancel
  2371. the special meaning of an ASCII character.
  2372.  
  2373. Conforming user agents must correctly map to Unicode all characters in any
  2374. character encodings that they recognize (or they must behave as if they
  2375. did).
  2376.  
  2377. For example, a document transmitted as ISO-8859-1 (Latin-1) cannot contain
  2378. Greek letters directly: "??????" (Greek: "kouros") has to be written as
  2379. "\3BA\3BF\3C5\3C1\3BF\3C2".
  2380.  
  2381. Note. In HTML 4.0, numeric character references are interpreted in "style"
  2382. attribute values but not in the content of the STYLE element. Because of
  2383. this asymmetry, we recommend that authors use the CSS character escape
  2384. mechanism rather than numeric character references for both the "style"
  2385. attribute and the STYLE element. For example, we recommend:
  2386.  
  2387. <SPAN style="voice-family: D\FC rst">...</SPAN>
  2388.  
  2389. rather than:
  2390.  
  2391. <SPAN style="voice-family: Dürst">...</SPAN>
  2392.  
  2393.   ------------------------------------------------------------------------
  2394.   ------------------------------------------------------------------------
  2395.  
  2396.                                  5 Selectors
  2397.  
  2398. Contents
  2399.  
  2400.    * 5.1 Pattern matching
  2401.    * 5.2 Selector syntax
  2402.         o 5.2.1 Grouping
  2403.    * 5.3 Universal selector
  2404.    * 5.4 Type selectors
  2405.    * 5.5 Descendant selectors
  2406.    * 5.6 Child selectors
  2407.    * 5.7 Adjacent sibling selectors
  2408.    * 5.8 Attribute selectors
  2409.         o 5.8.1 Matching attributes and attribute values
  2410.         o 5.8.2 Default attribute values in DTDs
  2411.         o 5.8.3 Class selectors
  2412.    * 5.9 ID selectors
  2413.    * 5.10 Pseudo-elements and pseudo-classes
  2414.    * 5.11 Pseudo-classes
  2415.         o 5.11.1 :first-child pseudo-class
  2416.         o 5.11.2 The link pseudo-classes: :link and :visited
  2417.         o 5.11.3 The dynamic pseudo-classes: :hover, :active, and :focus
  2418.         o 5.11.4 The language pseudo-class: :lang
  2419.    * 5.12 Pseudo-elements
  2420.         o 5.12.1 The :first-line pseudo-element
  2421.         o 5.12.2 The :first-letter pseudo-element
  2422.         o 5.12.3 The :before and :after pseudo-elements
  2423.  
  2424. 5.1 Pattern matching
  2425.  
  2426. In CSS, pattern matching rules determine which style rules apply to elements
  2427. in the document tree. These patterns, called selectors, may range from
  2428. simple element names to rich contextual patterns. If all conditions in the
  2429. pattern are true for a certain element, the selector matches the element.
  2430.  
  2431. The case-sensitivity of document language element names in selectors depends
  2432. on the document language. For example, in HTML, element names are
  2433. case-insensitive, but in XML they are case-sensitive.
  2434.  
  2435. The following table summarizes CSS2 selector syntax:
  2436.  
  2437.       Pattern                    Meaning               Described in section
  2438.  *                Matches any element.                 Universal selector
  2439.  
  2440.  E                Matches any E element (i.e., an      Type selectors
  2441.                   element of type E).
  2442.  
  2443.  E F              Matches any F element that is a      Descendant selectors
  2444.                   descendant of an E element.
  2445.  
  2446.  E > F            Matches any F element that is a      Child selectors
  2447.                   child of an element E.
  2448.  
  2449.  E:first-child    Matches element E when E is the      The :first-child
  2450.                   first child of its parent.           pseudo-class
  2451.                   Matches element E if E is the source
  2452.  E:link           anchor of a hyperlink of which the   The link
  2453.  E:visited        target is not yet visited (:link) or pseudo-classes
  2454.                   already visited (:visited).
  2455.  E:active
  2456.  E:hover          Matches E during certain user        The dynamic
  2457.  E:focus          actions.                             pseudo-classes
  2458.                   Matches element of type E if it is
  2459.  E:lang(c)        in (human) language c (the document  The :lang()
  2460.                   language specifies how language is   pseudo-class
  2461.                   determined).
  2462.  
  2463.  E + F            Matches any F element immediately    Adjacent selectors
  2464.                   preceded by an element E.
  2465.  
  2466.  E[foo]           Matches any E element with the "foo" Attribute selectors
  2467.                   attribute set (whatever the value).
  2468.                   Matches any E element whose "foo"
  2469.  E[foo="warning"] attribute value is exactly equal to  Attribute selectors
  2470.                   "warning".
  2471.                   Matches any E element whose "foo"
  2472.  E[foo~="warning"]attribute value is a list of         Attribute selectors
  2473.                   space-separated values, one of which
  2474.                   is exactly equal to "warning".
  2475.                   Matches any E element whose "lang"
  2476.  E[lang|="en"]    attribute has a hyphen-separated     Attribute selectors
  2477.                   list of values beginning (from the
  2478.                   left) with "en".
  2479.  
  2480.  DIV.warning      HTML only. The same as               Class selectors
  2481.                   DIV[class~="warning"].
  2482.  
  2483.  E#myid           Matches any E element ID equal to    ID selectors
  2484.                   "myid".
  2485.  
  2486. 5.2 Selector syntax
  2487.  
  2488. A simple selector is either a type selector or universal selector followed
  2489. immediately by zero or more attribute selectors, ID selectors, or
  2490. pseudo-classes, in any order. The simple selector matches if all of its
  2491. components match.
  2492.  
  2493. A selector is a chain of one or more simple selectors separated by
  2494. combinators. Combinators are: whitespace, ">", and "+". Whitespace may
  2495. appear between a combinator and the simple selectors around it.
  2496.  
  2497. The elements of the document tree that match a selector are called subjects
  2498. of the selector. A selector consisting of a single simple selector matches
  2499. any element satisfying its requirements. Prepending a simple selector and
  2500. combinator to a chain imposes additional matching constraints, so the
  2501. subjects of a selector are always a subset of the elements matching the
  2502. rightmost simple selector.
  2503.  
  2504. One pseudo-element may be appended to the last simple selector in a chain,
  2505. in which case the style information applies to a subpart of each subject.
  2506.  
  2507. 5.2.1 Grouping
  2508.  
  2509. When several selectors share the same declarations, they may be grouped into
  2510. a comma-separated list.
  2511.  
  2512. Example(s):
  2513.  
  2514. In this example, we condense three rules with identical declarations into
  2515. one. Thus,
  2516.  
  2517. H1 { font-family: sans-serif }
  2518. H2 { font-family: sans-serif }
  2519. H3 { font-family: sans-serif }
  2520.  
  2521. is equivalent to:
  2522.  
  2523. H1, H2, H3 { font-family: sans-serif }
  2524.  
  2525. CSS offers other "shorthand" mechanisms as well, including multiple
  2526. declarations and shorthand properties.
  2527.  
  2528. 5.3 Universal selector
  2529.  
  2530. The universal selector, written "*", matches the name of any element type.
  2531. It matches any single element in the document tree.
  2532.  
  2533. If the universal selector is not the only component of a simple selector,
  2534. the "*" may be omitted. For example:
  2535.  
  2536.    * *[LANG=fr] and [LANG=fr] are equivalent.
  2537.    * *.warning and .warning are equivalent.
  2538.    * *#myid and #myid are equivalent.
  2539.  
  2540. 5.4 Type selectors
  2541.  
  2542. A type selector matches the name of a document language element type. A type
  2543. selector matches every instance of the element type in the document tree.
  2544.  
  2545. Example(s):
  2546.  
  2547. The following rule matches all H1 elements in the document tree:
  2548.  
  2549. H1 { font-family: sans-serif }
  2550.  
  2551. 5.5 Descendant selectors
  2552.  
  2553. At times, authors may want selectors to match an element that is the
  2554. descendant of another element in the document tree (e.g., "Match those EM
  2555. elements that are contained by an H1 element"). Descendant selectors express
  2556. such a relationship in a pattern. A descendant selector is made up of two or
  2557. more selectors separated by whitespace. A descendant selector of the form "A
  2558. B" matches when an element B is an arbitrary descendant of some ancestor
  2559. element A.
  2560.  
  2561. Example(s):
  2562.  
  2563. For example, consider the following rules:
  2564.  
  2565. H1 { color: red }
  2566. EM { color: red }
  2567.  
  2568. Although the intention of these rules is to add emphasis to text by changing
  2569. its color, the effect will be lost in a case such as:
  2570.  
  2571. <H1>This headline is <EM>very</EM> important</H1>
  2572.  
  2573. We address this case by supplementing the previous rules with a rule that
  2574. sets the text color to blue whenever an EM occurs anywhere within an H1:
  2575.  
  2576. H1 { color: red }
  2577. EM { color: red }
  2578. H1 EM { color: blue }
  2579.  
  2580. The third rule will match the EM in the following fragment:
  2581.  
  2582. <H1>This <SPAN class="myclass">headline
  2583. is <EM>very</EM> important</SPAN></H1>
  2584.  
  2585. Example(s):
  2586.  
  2587. The following selector:
  2588.  
  2589. DIV * P
  2590.  
  2591. matches a P element that is a grandchild or later descendant of a DIV
  2592. element. Note the whitespace on either side of the "*".
  2593.  
  2594. Example(s):
  2595.  
  2596. The selector in the following rule, which combines descendant and attribute
  2597. selectors, matches any element that (1) has the "href" attribute set and (2)
  2598. is inside a P that is itself inside a DIV:
  2599.  
  2600. DIV P *[href]
  2601.  
  2602. 5.6 Child selectors
  2603.  
  2604. A child selector matches when an element is the child of some element. A
  2605. child selector is made up of two or more selectors separated by ">".
  2606.  
  2607. Example(s):
  2608.  
  2609. The following rule sets the style of all P elements that are children of
  2610. BODY:
  2611.  
  2612. BODY > P { line-height: 1.3 }
  2613.  
  2614. Example(s):
  2615.  
  2616. The following example combines descendant selectors and child selectors:
  2617.  
  2618. DIV OL>LI P
  2619.  
  2620. It matches a P element that is a descendant of an LI; the LI element must be
  2621. the child of an OL element; the OL element must be a descendant of a DIV.
  2622. Notice that the optional whitespace around the ">" combinator has been left
  2623. out.
  2624.  
  2625. For information on selecting the first child of an element, please see the
  2626. section on the :first-child pseudo-class below.
  2627.  
  2628. 5.7 Adjacent sibling selectors
  2629.  
  2630. Adjacent sibling selectors have the following syntax: E1 + E2, where E2 is
  2631. the subject of the selector. The selector matches if E1 and E2 share the
  2632. same parent in the document tree and E1 immediately precedes E2.
  2633.  
  2634. In some contexts, adjacent elements generate formatting objects whose
  2635. presentation is handled automatically (e.g., collapsing vertical margins
  2636. between adjacent boxes). The "+" selector allows authors to specify
  2637. additional style to adjacent elements.
  2638.  
  2639. Example(s):
  2640.  
  2641. Thus, the following rule states that when a P element immediately follows a
  2642. MATH element, it should not be indented:
  2643.  
  2644. MATH + P { text-indent: 0 }
  2645.  
  2646. The next example reduces the vertical space separating an H1 and an H2 that
  2647. immediately follows it:
  2648.  
  2649. H1 + H2 { margin-top: -5mm }
  2650.  
  2651. Example(s):
  2652.  
  2653. The following rule is similar to the one in the previous example, except
  2654. that it adds an attribute selector. Thus, special formatting only occurs
  2655. when H1 has class="opener":
  2656.  
  2657. H1.opener + H2 { margin-top: -5mm }
  2658.  
  2659. 5.8 Attribute selectors
  2660.  
  2661. CSS2 allows authors to specify rules that match attributes defined in the
  2662. source document.
  2663.  
  2664. 5.8.1 Matching attributes and attribute values
  2665.  
  2666. Attribute selectors may match in four ways:
  2667.  
  2668. [att]
  2669.      Match when the element sets the "att" attribute, whatever the value of
  2670.      the attribute.
  2671. [att=val]
  2672.      Match when the element's "att" attribute value is exactly "val".
  2673. [att~=val]
  2674.      Match when the element's "att" attribute value is a space-separated
  2675.      list of "words", one of which is exactly "val". If this selector is
  2676.      used, the words in the value must not contain spaces (since they are
  2677.      separated by spaces).
  2678. [att|=val]
  2679.      Match when the element's "att" attribute value is a hyphen-separated
  2680.      list of "words", beginning with "val". The match always starts at the
  2681.      beginning of the attribute value. This is primarily intended to allow
  2682.      language subcode matches (e.g., the "lang" attribute in HTML) as
  2683.      described in RFC 1766 ([RFC1766]).
  2684.  
  2685. Attribute values must be identifiers or strings. The case-sensitivity of
  2686. attribute names and values in selectors depends on the document language.
  2687.  
  2688. Example(s):
  2689.  
  2690. For example, the following attribute selector matches all H1 elements that
  2691. specify the "title" attribute, whatever its value:
  2692.  
  2693. H1[title] { color: blue; }
  2694.  
  2695. Example(s):
  2696.  
  2697. In the following example, the selector matches all SPAN elements whose
  2698. "class" attribute has exactly the value "example":
  2699.  
  2700. SPAN[class=example] { color: blue; }
  2701.  
  2702. Multiple attribute selectors can be used to refer to several attributes of
  2703. an element, or even several times the same attribute.
  2704.  
  2705. Example(s):
  2706.  
  2707. Here, the selector matches all SPAN elements whose "hello" attribute has
  2708. exactly the value "Cleveland" and whose "goodbye" attribute has exactly the
  2709. value "Columbus":
  2710.  
  2711. SPAN[hello="Cleveland"][goodbye="Columbus"] { color: blue; }
  2712.  
  2713. Example(s):
  2714.  
  2715. The following selectors illustrate the differences between "=" and "~=". The
  2716. first selector will match, for example, the value "copyright copyleft
  2717. copyeditor" for the "rel" attribute. The second selector will only match
  2718. when the "href" attribute has the value "http://www.w3.org/".
  2719.  
  2720. A[rel~="copyright"]
  2721. A[href="http://www.w3.org/"]
  2722.  
  2723. Example(s):
  2724.  
  2725. The following rule hides all elements for which the value of the "lang"
  2726. attribute is "fr" (i.e., the language is French).
  2727.  
  2728. *[LANG=fr] { display : none }
  2729.  
  2730. Example(s):
  2731.  
  2732. The following rule will match for values of the "lang" attribute that begin
  2733. with "en", including "en", "en-US", and "en-cockney":
  2734.  
  2735. *[LANG|="en"] { color : red }
  2736.  
  2737. Example(s):
  2738.  
  2739. Similarly, the following aural style sheet rules allow a script to be read
  2740. aloud in different voices for each role:
  2741.  
  2742. DIALOGUE[character=romeo]
  2743.      { voice-family: "Lawrence Olivier", charles, male }
  2744.  
  2745. DIALOGUE[character=juliet]
  2746.      { voice-family: "Vivien Leigh", victoria, female }
  2747.  
  2748. 5.8.2 Default attribute values in DTDs
  2749.  
  2750. Matching takes place on attribute values in the document tree. For document
  2751. languages other than HTML, default attribute values may be defined in a DTD
  2752. or elsewhere. Style sheets should be designed so that they work even if the
  2753. default values are not included in the document tree.
  2754.  
  2755. Example(s):
  2756.  
  2757. For example, consider an element EXAMPLE with an attribute "notation" that
  2758. has a default value of "decimal". The DTD fragment might be
  2759.  
  2760. <!ATTLIST EXAMPLE notation (decimal,octal) "decimal">
  2761.  
  2762. If the style sheet contains the rules
  2763.  
  2764. EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
  2765. EXAMPLE[notation=octal] { /*... other settings...*/ }
  2766.  
  2767. then to catch the cases where this attribute is set by default, and not
  2768. explicitly, the following rule might be added:
  2769.  
  2770. EXAMPLE { /*... default property settings ...*/ }
  2771.  
  2772. Because this selector is less specific than an attribute selector, it will
  2773. only be used for the default case. Care has to be taken that all other
  2774. attribute values that don't get the same style as the default are explicitly
  2775. covered.
  2776.  
  2777. 5.8.3 Class selectors
  2778.  
  2779. For style sheets used with HTML, authors may use the dot (.) notation as an
  2780. alternative to the "~=" notation when matching on the "class" attribute.
  2781. Thus, for HTML, "DIV.value" and "DIV[class~=value]" have the same meaning.
  2782. The attribute value must immediately follow the ".".
  2783.  
  2784. Example(s):
  2785.  
  2786. For example, we can assign style information to all elements with
  2787. class~="pastoral" as follows:
  2788.  
  2789. *.pastoral { color: green }  /* all elements with class~=pastoral */
  2790.  
  2791. or just
  2792.  
  2793. .pastoral { color: green }  /* all elements with class~=pastoral */
  2794.  
  2795. The following assigns style only to H1 elements with class~="pastoral":
  2796.  
  2797. H1.pastoral { color: green }  /* H1 elements with class~=pastoral */
  2798.  
  2799. Given these rules, the first H1 instance below would not have green text,
  2800. while the second would:
  2801.  
  2802. <H1>Not green</H1>
  2803. <H1 class="pastoral">Very green</H1>
  2804.  
  2805. To match a subset of "class" values, each value must be preceded by a ".",
  2806. in any order.
  2807.  
  2808. Example(s):
  2809.  
  2810. For example, the following rule matches any P element whose "class"
  2811. attribute has been assigned a list of space-separated values that includes
  2812. "pastoral" and "marine":
  2813.  
  2814.  
  2815. P.pastoral.marine { color: green }
  2816.  
  2817. This rule matches when class="pastoral blue aqua marine" but does not match
  2818. for class="pastoral blue".
  2819.  
  2820. Note. CSS gives so much power to the "class" attribute, that authors could
  2821. conceivably design their own "document language" based on elements with
  2822. almost no associated presentation (such as DIV and SPAN in HTML) and
  2823. assigning style information through the "class" attribute. Authors should
  2824. avoid this practice since the structural elements of a document language
  2825. often have recognized and accepted meanings and author-defined classes may
  2826. not.
  2827.  
  2828. 5.9 ID selectors
  2829.  
  2830. Document languages may contain attributes that are declared to be of type
  2831. ID. What makes attributes of type ID special is that no two such attributes
  2832. can have the same value; whatever the document language, an ID attribute can
  2833. be used to uniquely identify its element. In HTML all ID attributes are
  2834. named "id"; XML applications may name ID attributes differently, but the
  2835. same restriction applies.
  2836.  
  2837. The ID attribute of a document language allows authors to assign an
  2838. identifier to one element instance in the document tree. CSS ID selectors
  2839. match an element instance based on its identifier. A CSS ID selector
  2840. contains a "#" immediately followed by the ID value.
  2841.  
  2842. Example(s):
  2843.  
  2844. The following ID selector matches the H1 element whose ID attribute has the
  2845. value "chapter1":
  2846.  
  2847. H1#chapter1 { text-align: center }
  2848.  
  2849. In the following example, the style rule matches the element that has the ID
  2850. value "z98y". The rule will thus match for the P element:
  2851.  
  2852. <HEAD>
  2853.   <TITLE>Match P</TITLE>
  2854.   <STYLE type="text/css">
  2855.     *#z98y { letter-spacing: 0.3em }
  2856.   </STYLE>
  2857. </HEAD>
  2858. <BODY>
  2859.    <P id=z98y>Wide text</P>
  2860. </BODY>
  2861.  
  2862. In the next example, however, the style rule will only match an H1 element
  2863. that has an ID value of "z98y". The rule will not match the P element in
  2864. this example:
  2865.  
  2866. <HEAD>
  2867.   <TITLE>Match H1 only</TITLE>
  2868.   <STYLE type="text/css">
  2869.     H1#z98y { letter-spacing: 0.5em }
  2870.   </STYLE>
  2871. </HEAD>
  2872. <BODY>
  2873.    <P id=z98y>Wide text</P>
  2874. </BODY>
  2875.  
  2876. ID selectors have a higher precedence than attribute selectors. For example,
  2877. in HTML, the selector #p123 is more specific than [ID=p123] in terms of the
  2878. cascade.
  2879.  
  2880. Note. In XML 1.0 [XML10], the information about which attribute contains an
  2881. element's IDs is contained in a DTD. When parsing XML, UAs do not always
  2882. read the DTD, and thus may not know what the ID of an element is. If a style
  2883. sheet designer knows or suspects that this will be the case, he should use
  2884. normal attribute selectors instead: [name=p371] instead of #p371. However,
  2885. the cascading order of normal attribute selectors is different from ID
  2886. selectors. It may be necessary to add an "!important" priority to the
  2887. declarations: [name=p371] {color: red ! important}. Of course, elements in
  2888. XML 1.0 documents without a DTD do not have IDs at all.
  2889.  
  2890. 5.10 Pseudo-elements and pseudo-classes
  2891.  
  2892. In CSS2, style is normally attached to an element based on its position in
  2893. the document tree. This simple model is sufficient for many cases, but some
  2894. common publishing scenarios may not be possible due to the structure of the
  2895. document tree. For instance, in HTML 4.0 (see [HTML40]), no element refers
  2896. to the first line of a paragraph, and therefore no simple CSS selector may
  2897. refer to it.
  2898.  
  2899. CSS introduces the concepts of pseudo-elements and pseudo-classes to permit
  2900. formatting based on information that lies outside the document tree.
  2901.  
  2902.    * Pseudo-elements create abstractions about the document tree beyond
  2903.      those specified by the document language. For instance, document
  2904.      languages do not offer mechanisms to access the first letter or first
  2905.      line of an element's content. CSS pseudo-elements allow style sheet
  2906.      designers to refer to this otherwise inaccessible information.
  2907.      Pseudo-elements may also provide style sheet designers a way to assign
  2908.      style to content that does not exist in the source document (e.g., the
  2909.      :before and :after pseudo-elements give access to generated content).
  2910.    * Pseudo-classes classify elements on characteristics other than their
  2911.      name, attributes or content; in principle characteristics that cannot
  2912.      be deduced from the document tree. Pseudo-classes may be dynamic, in
  2913.      the sense that an element may acquire or lose a pseudo-class while a
  2914.      user interacts with the document. The exception is ':first-child',
  2915.      which can be deduced from the document tree.
  2916.  
  2917. Neither pseudo-elements nor pseudo-classes appear in the document source or
  2918. document tree.
  2919.  
  2920. Pseudo-classes are allowed anywhere in selectors while pseudo-elements may
  2921. only appear after the subject of the selector.
  2922.  
  2923. Pseudo-elements and pseudo-class names are case-insensitive.
  2924.  
  2925. Some pseudo-classes are mutually exclusive, while others can be applied
  2926. simultaneously to the same element. In case of conflicting rules, the normal
  2927. cascading order determines the outcome.
  2928.  
  2929. Conforming HTML user agents may ignore all rules with :first-line or
  2930. :first-letter in the selector, or, alternatively, may only support a subset
  2931. of the properties on these pseudo-elements.
  2932.  
  2933. 5.11 Pseudo-classes
  2934.  
  2935. 5.11.1 :first-child pseudo-class
  2936.  
  2937. The :first-child pseudo-class matches an element that is the first child of
  2938. some other element.
  2939.  
  2940. Example(s):
  2941.  
  2942. In the following example, the selector matches any P element that is the
  2943. first child of a DIV element. The rule suppresses indentation for the first
  2944. paragraph of a DIV:
  2945.  
  2946. DIV > P:first-child { text-indent: 0 }
  2947.  
  2948. This selector would match the P inside the DIV of the following fragment:
  2949.  
  2950. <P> The last P before the note.
  2951. <DIV class="note">
  2952.    <P> The first P inside the note.
  2953. </DIV>
  2954.  
  2955. but would not match the second P in the following fragment:
  2956.  
  2957. <P> The last P before the note.
  2958. <DIV class="note">
  2959.    <H2>Note</H2>
  2960.    <P> The first P inside the note.
  2961. </DIV>
  2962.  
  2963. Example(s):
  2964.  
  2965. The following rule sets the font weight to 'bold' for any EM element that is
  2966. some descendant of a P element that is a first child:
  2967.  
  2968. P:first-child EM { font-weight : bold }
  2969.  
  2970. Note that since anonymous boxes are not part of the document tree, they are
  2971. not counted when calculating the first child.
  2972.  
  2973. For example, the EM in:
  2974.  
  2975. <P>abc <EM>default</EM>
  2976.  
  2977. is the first child of the P.
  2978.  
  2979. The following two selectors are equivalent:
  2980.  
  2981. * > A:first-child   /* A is first child of any element */
  2982. A:first-child       /* Same */
  2983.  
  2984. 5.11.2 The link pseudo-classes: :link and :visited
  2985.  
  2986. User agents commonly display unvisited links differently from previously
  2987. visited ones. CSS provides the pseudo-classes ':link' and ':visited' to
  2988. distinguish them:
  2989.  
  2990.    * The :link pseudo-class applies for links that have not yet been
  2991.      visited.
  2992.    * The :visited pseudo-class applies once the link has been visited by the
  2993.      user.
  2994.  
  2995. Note. After a certain amount of time, user agents may choose to return a
  2996. visited link to the (unvisited) ':link' state.
  2997.  
  2998. The two states are mutually exclusive.
  2999.  
  3000. The document language determines which elements are hyperlink source
  3001. anchors. For example, in HTML 4.0, the link pseudo-classes apply to A
  3002. elements with an "href" attribute. Thus, the following two CSS2 declarations
  3003. have similar effect:
  3004.  
  3005. A:link { color: red }
  3006. :link  { color: red }
  3007.  
  3008. Example(s):
  3009.  
  3010. If the following link:
  3011.  
  3012. <A class="external" href="http://out.side/">external link</A>
  3013.  
  3014. has been visited, this rule:
  3015.  
  3016. A.external:visited { color: blue }
  3017.  
  3018. will cause it to be blue.
  3019.  
  3020. 5.11.3 The dynamic pseudo-classes: :hover, :active, and :focus
  3021.  
  3022. Interactive user agents sometimes change the rendering in response to user
  3023. actions. CSS provides three pseudo-classes for common cases:
  3024.  
  3025.    * The :hover pseudo-class applies while the user designates an element
  3026.      (with some pointing device), but does not activate it. For example, a
  3027.      visual user agent could apply this pseudo-class when the cursor (mouse
  3028.      pointer) hovers over a box generated by the element. User agents not
  3029.      supporting interactive media do not have to support this pseudo-class.
  3030.      Some conforming user agents supporting interactive media may not be
  3031.      able to support this pseudo-class (e.g., a pen device).
  3032.    * The :active pseudo-class applies while an element is being activated by
  3033.      the user. For example, between the times the user presses the mouse
  3034.      button and releases it.
  3035.    * The :focus pseudo-class applies while an element has the focus (accepts
  3036.      keyboard events or other forms of text input).
  3037.  
  3038. These pseudo-classes are not mutually exclusive. An element may match
  3039. several of them at the same time.
  3040.  
  3041. CSS doesn't define which elements may be in the above states, or how the
  3042. states are entered and left. Scripting may change whether elements react to
  3043. user events or not, and different devices and UAs may have different ways of
  3044. pointing to, or activating elements.
  3045.  
  3046. User agents are not required to reflow a currently displayed document due to
  3047. pseudo-class transitions. For instance, a style sheet may specify that the
  3048. 'font-size' of an :active link should be larger than that of an inactive
  3049. link, but since this may cause letters to change position when the reader
  3050. selects the link, a UA may ignore the corresponding style rule.
  3051.  
  3052. Example(s):
  3053.  
  3054. A:link    { color: red }    /* unvisited links */
  3055. A:visited { color: blue }   /* visited links   */
  3056. A:hover   { color: yellow } /* user hovers     */
  3057. A:active  { color: lime }   /* active links    */
  3058.  
  3059. Note that the A:hover must be placed after the A:link and A:visited rules,
  3060. since otherwise the cascading rules will hide the 'color' property of the
  3061. A:hover rule. Similarly, because A:active is placed after A:hover, the
  3062. active color (lime) will apply when the user both activates and hovers over
  3063. the A element.
  3064.  
  3065. Example(s):
  3066.  
  3067. An example of combining dynamic pseudo-classes:
  3068.  
  3069. A:focus { background: yellow }
  3070. A:focus:hover { background: white }
  3071.  
  3072. The last selector matches A elements that are in pseudo-class :focus and in
  3073. pseudo-class :hover.
  3074.  
  3075. For information about the presentation of focus outlines, please consult the
  3076. section on dynamic focus outlines.
  3077.  
  3078. Note. In CSS1, the ':active' pseudo-class was mutually exclusive with
  3079. ':link' and ':visited'. That is no longer the case. An element can be both
  3080. ':visited' and ':active' (or ':link' and ':active') and the normal cascading
  3081. rules determine which properties apply.
  3082.  
  3083. 5.11.4 The language pseudo-class: :lang
  3084.  
  3085. If the document language specifies how the human language of an element is
  3086. determined, it is possible to write selectors in CSS that match an element
  3087. based on its language. For example, in HTML [HTML40], the language is
  3088. determined by a combination of the "lang" attribute, the META element, and
  3089. possibly by information from the protocol (such as HTTP headers). XML uses
  3090. an attribute called XML:LANG, and there may be other document
  3091. language-specific methods for determining the language.
  3092.  
  3093. The pseudo-class ':lang(C)' matches if the element is in language C. Here C
  3094. is a language code as specified in HTML 4.0 [HTML40] and RFC 1766 [RFC1766].
  3095. It is matched the same way as for the '|=' operator.
  3096.  
  3097. Example(s):
  3098.  
  3099. The following rules set the quotation marks for an HTML document that is
  3100. either in French or German:
  3101.  
  3102. HTML:lang(fr) { quotes: '´ ' ' ª' }
  3103. HTML:lang(de) { quotes: 'ª' '´' '\2039' '\203A' }
  3104. :lang(fr) > Q { quotes: '´ ' ' ª' }
  3105. :lang(de) > Q { quotes: 'ª' '´' '\2039' '\203A' }
  3106.  
  3107. The second pair of rules actually set the 'quotes' property on Q elements
  3108. according to the language of its parent. This is done because the choice of
  3109. quote marks is typically based on the language of the element around the
  3110. quote, not the quote itself: like this piece of French "‡ l'improviste" in
  3111. the middle of an English text uses the English quotation marks.
  3112.  
  3113. 5.12 Pseudo-elements
  3114.  
  3115. 5.12.1 The :first-line pseudo-element
  3116.  
  3117. The :first-line pseudo-element applies special styles to the first formatted
  3118. line of a paragraph. For instance:
  3119.  
  3120. P:first-line { text-transform: uppercase }
  3121.  
  3122. The above rule means "change the letters of the first line of every
  3123. paragraph to uppercase". However, the selector "P:first-line" does not match
  3124. any real HTML element. It does match a pseudo-element that conforming user
  3125. agents will insert at the beginning of every paragraph.
  3126.  
  3127. Note that the length of the first line depends on a number of factors,
  3128. including the width of the page, the font size, etc. Thus, an ordinary HTML
  3129. paragraph such as:
  3130.  
  3131. <P>This is a somewhat long HTML
  3132. paragraph that will be broken into several
  3133. lines. The first line will be identified
  3134. by a fictional tag sequence. The other lines
  3135. will be treated as ordinary lines in the
  3136. paragraph.</P>
  3137.  
  3138. the lines of which happen to be broken as follows:
  3139.  
  3140. THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
  3141. will be broken into several lines. The first
  3142. line will be identified by a fictional tag
  3143. sequence. The other lines will be treated as
  3144. ordinary lines in the paragraph.
  3145.  
  3146. might be "rewritten" by user agents to include the fictional tag sequence
  3147. for :first-line. This fictional tag sequence helps to show how properties
  3148. are inherited.
  3149.  
  3150. <P><P:first-line> This is a somewhat long HTML
  3151. paragraph that will </P:first-line> be broken into several
  3152. lines. The first line will be identified
  3153. by a fictional tag sequence. The other lines
  3154. will be treated as ordinary lines in the
  3155. paragraph.</P>
  3156.  
  3157. If a pseudo-element breaks up a real element, the desired effect can often
  3158. be described by a fictional tag sequence that closes and then re-opens the
  3159. element. Thus, if we mark up the previous paragraph with a SPAN element:
  3160.  
  3161. <P><SPAN class="test"> This is a somewhat long HTML
  3162. paragraph that will be broken into several
  3163. lines.</SPAN> The first line will be identified
  3164. by a fictional tag sequence. The other lines
  3165. will be treated as ordinary lines in the
  3166. paragraph.</P>
  3167.  
  3168. the user agent could generate the appropriate start and end tags for SPAN
  3169. when inserting the fictional tag sequence for :first-line.
  3170.  
  3171. <P><P:first-line><SPAN class="test"> This is a
  3172. somewhat long HTML
  3173. paragraph that will </SPAN></P:first-line><SPAN class="test"> be
  3174. broken into several
  3175. lines.</SPAN> The first line will be identified
  3176. by a fictional tag sequence. The other lines
  3177. will be treated as ordinary lines in the
  3178. paragraph.</P>
  3179.  
  3180. The :first-line pseudo-element can only be attached to a block-level
  3181. element.
  3182.  
  3183. The :first-line pseudo-element is similar to an inline-level element, but
  3184. with certain restrictions. Only the following properties apply to a
  3185. :first-line pseudo-element: font properties, color properties, background
  3186. properties, 'word-spacing', 'letter-spacing', 'text-decoration',
  3187. 'vertical-align', 'text-transform', 'line-height', 'text-shadow', and
  3188. 'clear'.
  3189.  
  3190. 5.12.2 The :first-letter pseudo-element
  3191.  
  3192. The :first-letter pseudo-element may be used for "initial caps" and "drop
  3193. caps", which are common typographical effects. This type of initial letter
  3194. is similar to an inline-level element if its 'float' property is 'none',
  3195. otherwise it is similar to a floated element.
  3196.  
  3197. These are the properties that apply to :first-letter pseudo-elements: font
  3198. properties, color properties, background properties, 'text-decoration',
  3199. 'vertical-align' (only if 'float' is 'none'), 'text-transform',
  3200. 'line-height', margin properties, padding properties, border properties,
  3201. 'float', 'text-shadow', and 'clear'.
  3202.  
  3203. The following CSS2 will make a drop cap initial letter span two lines:
  3204.  
  3205. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  3206. <HTML>
  3207.  <HEAD>
  3208.   <TITLE>Drop cap initial letter</TITLE>
  3209.   <STYLE type="text/css">
  3210.    P              { font-size: 12pt; line-height: 12pt }
  3211.    P:first-letter { font-size: 200%; font-style: italic;
  3212.                     font-weight: bold; float: left }
  3213.    SPAN           { text-transform: uppercase }
  3214.   </STYLE>
  3215.  </HEAD>
  3216.  <BODY>
  3217.   <P><SPAN>The first</SPAN> few words of an article
  3218.     in The Economist.</P>
  3219.  </BODY>
  3220. </HTML>
  3221.  
  3222. This example might be formatted as follows:
  3223.  
  3224. [Image illustrating the combined effect of the :first-letter and :first-line pseudo-elements]   [D]
  3225.  
  3226. The fictional tag sequence is:
  3227.  
  3228. <P>
  3229. <SPAN>
  3230. <P:first-letter>
  3231. T
  3232. </P:first-letter>he first
  3233. </SPAN>
  3234. few words of an article in the Economist.
  3235. </P>
  3236.  
  3237. Note that the :first-letter pseudo-element tags abut the content (i.e., the
  3238. initial character), while the :first-line pseudo-element start tag is
  3239. inserted right after the start tag of the element to which it is attached.
  3240.  
  3241. In order to achieve traditional drop caps formatting, user agents may
  3242. approximate font sizes, for example to align baselines. Also, the glyph
  3243. outline may be taken into account when formatting.
  3244.  
  3245. Punctuation (i.e, characters defined in Unicode [UNICODE] in the "open"
  3246. (Ps), "close" (Pe), and "other" (Po) punctuation classes), that precedes the
  3247. first letter should be included, as in:
  3248.  
  3249. [Quotes that precede thefirst letter should be included.]   [D]
  3250.  
  3251. The :first-letter pseudo-element matches parts of block-level elements only.
  3252.  
  3253. Some languages may have specific rules about how to treat certain letter
  3254. combinations. In Dutch, for example, if the letter combination "ij" appears
  3255. at the beginning of a word, both letters should be considered within the
  3256. :first-letter pseudo-element.
  3257.  
  3258. Example(s):
  3259.  
  3260. The following example illustrates how overlapping pseudo-elements may
  3261. interact. The first letter of each P element will be green with a font size
  3262. of '24pt'. The rest of the first formatted line will be 'blue' while the
  3263. rest of the paragraph will be 'red'.
  3264.  
  3265. P { color: red; font-size: 12pt }
  3266. P:first-letter { color: green; font-size: 200% }
  3267. P:first-line { color: blue }
  3268.  
  3269. <P>Some text that ends up on two lines</P>
  3270.  
  3271. Assuming that a line break will occur before the word "ends", the fictional
  3272. tag sequence for this fragment might be:
  3273.  
  3274. <P>
  3275. <P:first-line>
  3276. <P:first-letter>
  3277. S
  3278. </P:first-letter>ome text that
  3279. </P:first-line>
  3280. ends up on two lines
  3281. </P>
  3282.  
  3283. Note that the :first-letter element is inside the :first-line element.
  3284. Properties set on :first-line are inherited by :first-letter, but are
  3285. overridden if the same property is set on :first-letter.
  3286.  
  3287. 5.12.3 The :before and :after pseudo-elements
  3288.  
  3289. The ':before' and ':after' pseudo-elements can be used to insert generated
  3290. content before or after an element's content. They are explained in the
  3291. section on generated text.
  3292.  
  3293. Example(s):
  3294.  
  3295. H1:before {content: counter(chapno, upper-roman) ". "}
  3296.  
  3297. When the :first-letter and :first-line pseudo-elements are combined with
  3298. :before and :after, they apply to the first letter or line of the element
  3299. including the inserted text.
  3300.  
  3301. Example(s):
  3302.  
  3303. P.special:before {content: "Special! "}
  3304. P.special:first-letter {color: #ffd800}
  3305.  
  3306. This will render the "S" of "Special!" in gold.
  3307.   ------------------------------------------------------------------------
  3308.   ------------------------------------------------------------------------
  3309.  
  3310.            6 Assigning property values, Cascading, and Inheritance
  3311.  
  3312. Contents
  3313.  
  3314.    * 6.1 Specified, computed, and actual values
  3315.         o 6.1.1 Specified values
  3316.         o 6.1.2 Computed values
  3317.         o 6.1.3 Actual values
  3318.    * 6.2 Inheritance
  3319.         o 6.2.1 The 'inherit' value
  3320.    * 6.3 The @import rule
  3321.    * 6.4 The cascade
  3322.         o 6.4.1 Cascading order
  3323.         o 6.4.2 !important rules
  3324.         o 6.4.3 Calculating a selector's specificity
  3325.         o 6.4.4 Precedence of non-CSS presentational hints
  3326.  
  3327. 6.1 Specified, computed, and actual values
  3328.  
  3329. Once a user agent has parsed a document and constructed a document tree, it
  3330. must assign, for every element in the tree, a value to every property that
  3331. applies to the target media type.
  3332.  
  3333. The final value of a property is the result of a three-step calculation: the
  3334. value is determined through specification (the "specified value"), then
  3335. resolved into an absolute value if necessary (the "computed value"), and
  3336. finally transformed according to the limitations of the local environment
  3337. (the "actual value").
  3338.  
  3339. 6.1.1 Specified values
  3340.  
  3341. User agents must first assign a specified value to a property based on the
  3342. following mechanisms (in order of precedence):
  3343.  
  3344.   1. If the cascade results in a value, use it.
  3345.   2. Otherwise, if the property is inherited, use the value of the parent
  3346.      element, generally the computed value.
  3347.   3. Otherwise use the property's initial value. The initial value of each
  3348.      property is indicated in the property's definition.
  3349.  
  3350. Since it has no parent, the root of the document tree cannot use values from
  3351. the parent element; in this case, the initial value is used if necessary.
  3352.  
  3353. 6.1.2 Computed values
  3354.  
  3355. Specified values may be absolute (i.e., they are not specified relative to
  3356. another value, as in 'red' or '2mm') or relative (i.e., they are specified
  3357. relative to another value, as in 'auto', '2em', and '12%'). For absolute
  3358. values, no computation is needed to find the computed value.
  3359.  
  3360. Relative values, on the other hand, must be transformed into computed
  3361. values: percentages must be multiplied by a reference value (each property
  3362. defines which value that is), values with relative units (em, ex, px) must
  3363. be made absolute by multiplying with the appropriate font or pixel size,
  3364. 'auto' values must be computed by the formulas given with each property,
  3365. certain keywords ('smaller', 'bolder', 'inherit') must be replaced according
  3366. to their definitions.
  3367.  
  3368. In most cases, elements inherit computed values. However, there are some
  3369. properties whose specified value may be inherited (e.g., the number value
  3370. for the 'line-height' property). In the cases where child elements do not
  3371. inherit the computed value, this is described in the property definition.
  3372.  
  3373. 6.1.3 Actual values
  3374.  
  3375. A computed value is in principle ready to be used, but a user agent may not
  3376. be able to make use of the value in a given environment. For example, a user
  3377. agent may only be able to render borders with integer pixel widths and may
  3378. therefore have to approximate the computed width. The actual value is the
  3379. computed value after any approximations have been applied.
  3380.  
  3381. 6.2 Inheritance
  3382.  
  3383. Some values are inherited by the children of an element in the document
  3384. tree. Each property defines whether it is inherited or not.
  3385.  
  3386. Suppose there is an H1 element with an emphasizing element (EM) inside:
  3387.  
  3388. <H1>The headline <EM>is</EM> important!</H1>
  3389.  
  3390. If no color has been assigned to the EM element, the emphasized "is" will
  3391. inherit the color of the parent element, so if H1 has the color blue, the EM
  3392. element will likewise be in blue.
  3393.  
  3394. To set a "default" style property for a document, authors may set the
  3395. property on the root of the document tree. In HTML, for example, the HTML or
  3396. BODY elements can serve this function. Note that this will work even if the
  3397. author omits the BODY tag in the HTML source since the HTML parser will
  3398. infer the missing tag.
  3399.  
  3400. Example(s):
  3401.  
  3402. For example, since the 'color' property is inherited, all descendants of the
  3403. BODY element will inherit the color 'black':
  3404.  
  3405. BODY { color: black; }
  3406.  
  3407. Specified percentage values are not inherited; computed values are.
  3408.  
  3409. Example(s):
  3410.  
  3411. For example, given the following style sheet:
  3412.  
  3413. BODY { font-size: 10pt }
  3414. H1 { font-size: 120% }
  3415.  
  3416. and this document fragment:
  3417.  
  3418. <BODY>
  3419.   <H1>A <EM>large</EM> heading</H1>
  3420. </BODY>
  3421.  
  3422. the 'font-size' property for the H1 element will have the computed value
  3423. '12pt' (120% times 10pt, the parent's value). Since the computed value of
  3424. 'font-size' is inherited, the EM element will have the computed value '12pt'
  3425. as well. If the user agent does not have the 12pt font available, the actual
  3426. value of 'font-size' for both H1 and EM might be, for example, '11pt'.
  3427.  
  3428. 6.2.1 The 'inherit' value
  3429.  
  3430. Each property may also have a specified value of 'inherit', which means
  3431. that, for a given element, the property takes the same computed value as the
  3432. property for the element's parent. The inherited value, which is normally
  3433. only used as a fallback value, can be strengthened by setting 'inherit'
  3434. explicitly.
  3435.  
  3436. Example(s):
  3437.  
  3438. In the example below, the 'color' and 'background' properties are set on the
  3439. BODY element. On all other elements, the 'color' value will be inherited and
  3440. the background will be transparent. If these rules are part of the user's
  3441. style sheet, black text on a white background will be enforced throughout
  3442. the document.
  3443.  
  3444. BODY {
  3445.   color: black !important;
  3446.   background: white !important;
  3447. }
  3448.  
  3449. * {
  3450.   color: inherit !important;
  3451.   background: transparent;
  3452. }
  3453.  
  3454. 6.3 The @import rule
  3455.  
  3456. The '@import' rule allows users to import style rules from other style
  3457. sheets. Any @import rules must precede all rule sets in a style sheet. The
  3458. '@import' keyword must be followed by the URI of the style sheet to include.
  3459. A string is also allowed; it will be interpreted as if it had url(...)
  3460. around it.
  3461.  
  3462. Example(s):
  3463.  
  3464. The following lines are equivalent in meaning and illustrate both '@import'
  3465. syntaxes (one with "url()" and one with a bare string):
  3466.  
  3467. @import "mystyle.css";
  3468. @import url("mystyle.css");
  3469.  
  3470. So that user agents can avoid retrieving resources for unsupported media
  3471. types, authors may specify media-dependent @import rules. These conditional
  3472. imports specify comma-separated media types after the URI.
  3473.  
  3474. Example(s):
  3475.  
  3476. The following rules have the same effect as if the imported style sheet were
  3477. wrapped in an @media rule for the same media, but it may save the UA a
  3478. fruitless download.
  3479.  
  3480. @import url("fineprint.css") print;
  3481. @import url("bluish.css") projection, tv;
  3482.  
  3483. In the absence of any media types, the import is unconditional. Specifying
  3484. 'all' for the medium has the same effect.
  3485.  
  3486. 6.4 The cascade
  3487.  
  3488. Style sheets may have three different origins: author, user, and user agent.
  3489.  
  3490.    * Author. The author specifies style sheets for a source document
  3491.      according to the conventions of the document language. For instance, in
  3492.      HTML, style sheets may be included in the document or linked
  3493.      externally.
  3494.    * User: The user may be able to specify style information for a
  3495.      particular document. For example, the user may specify a file that
  3496.      contains a style sheet or the user agent may provide an interface that
  3497.      generates a user style sheet (or behave as if it did).
  3498.    * User agent: Conforming user agents must apply a default style sheet (or
  3499.      behave as if they did) prior to all other style sheets for a document.
  3500.      A user agent's default style sheet should present the elements of the
  3501.      document language in ways that satisfy general presentation
  3502.      expectations for the document language (e.g., for visual browsers, the
  3503.      EM element in HTML is presented using an italic font). See "A sample
  3504.      style sheet for HTML 4.0" for a recommended default style sheet for
  3505.      HTML 4.0 documents.
  3506.  
  3507.      Note that the default style sheet may change if system settings are
  3508.      modified by the user (e.g., system colors). However, due to limitations
  3509.      in a user agent's internal implementation, it may be impossible to
  3510.      change the values in the default style sheet.
  3511.  
  3512. Style sheets from these three origins will overlap in scope, and they
  3513. interact according to the cascade.
  3514.  
  3515. The CSS cascade assigns a weight to each style rule. When several rules
  3516. apply, the one with the greatest weight takes precedence.
  3517.  
  3518. By default, rules in author style sheets have more weight than rules in user
  3519. style sheets. Precedence is reversed, however, for "!important" rules. All
  3520. rules user and author rules have more weight than rules in the UA's default
  3521. style sheet.
  3522.  
  3523. Imported style sheets also cascade and their weight depends on their import
  3524. order. Rules specified in a given style sheet override rules imported from
  3525. other style sheets. Imported style sheets can themselves import and override
  3526. other style sheets, recursively, and the same precedence rules apply.
  3527.  
  3528. 6.4.1 Cascading order
  3529.  
  3530. To find the value for an element/property combination, user agents must
  3531. apply the following sorting order:
  3532.  
  3533.   1. Find all declarations that apply to the element and property in
  3534.      question, for the target media type. Declarations apply if the
  3535.      associated selector matches the element in question.
  3536.   2. The primary sort of the declarations is by weight and origin: for
  3537.      normal declarations, author style sheets override user style sheets
  3538.      which override the default style sheet. For "!important" declarations,
  3539.      user style sheets override author style sheets which override the
  3540.      default style sheet. "!important" declaration override normal
  3541.      declarations. An imported style sheet has the same origin as the style
  3542.      sheet that imported it.
  3543.   3. The secondary sort is by specificity of selector: more specific
  3544.      selectors will override more general ones. Pseudo-elements and
  3545.      pseudo-classes are counted as normal elements and classes,
  3546.      respectively.
  3547.   4. Finally, sort by order specified: if two rules have the same weight,
  3548.      origin and specificity, the latter specified wins. Rules in imported
  3549.      style sheets are considered to be before any rules in the style sheet
  3550.      itself.
  3551.  
  3552. Apart from the "!important" setting on individual declarations, this
  3553. strategy gives author's style sheets higher weight than those of the reader.
  3554. It is therefore important that the user agent give the user the ability to
  3555. turn off the influence of a certain style sheet, e.g., through a pull-down
  3556. menu.
  3557.  
  3558. 6.4.2 !important rules
  3559.  
  3560. CSS attempts to create a balance of power between author and user style
  3561. sheets. By default, rules in an author's style sheet override those in a
  3562. user's style sheet (see cascade rule 3).
  3563.  
  3564. However, for balance, an "!important" declaration (the keywords "!" and
  3565. "important" follow the declaration) takes precedence over a normal
  3566. declaration. Both author and user style sheets may contain "!important"
  3567. declarations, and user "!important" rules override author "!important"
  3568. rules. This CSS feature improves accessibility of documents by giving users
  3569. with special requirements (large fonts, color combinations, etc.) control
  3570. over presentation.
  3571.  
  3572. Note. This is a semantic change since CSS1. In CSS1, author "!important"
  3573. rules took precedence over user "!important" rules.
  3574.  
  3575. Declaring a shorthand property (e.g., 'background') to be "!important" is
  3576. equivalent to declaring all of its sub-properties to be "!important".
  3577.  
  3578. Example(s):
  3579.  
  3580. The first rule in the user's style sheet in the following example contains
  3581. an "!important" declaration, which overrides the corresponding declaration
  3582. in the author's styles sheet. The second declaration will also win due to
  3583. being marked "!important". However, the third rule in the user's style sheet
  3584. is not "!important" and will therefore lose to the second rule in the
  3585. author's style sheet (which happens to set style on a shorthand property).
  3586. Also, the third author rule will lose to the second author rule since the
  3587. second rule is "!important". This shows that "!important" declarations have
  3588. a function also within author style sheets.
  3589.  
  3590. /* From the user's style sheet */
  3591. P { text-indent: 1em ! important }
  3592. P { font-style: italic ! important }
  3593. P { font-size: 18pt }
  3594.  
  3595. /* From the author's style sheet */
  3596. P { text-indent: 1.5em !important }
  3597. P { font: 12pt sans-serif !important }
  3598. P { font-size: 24pt }
  3599.  
  3600. 6.4.3 Calculating a selector's specificity
  3601.  
  3602. A selector's specificity is calculated as follows:
  3603.  
  3604.    * count the number of ID attributes in the selector (= a)
  3605.    * count the number of other attributes and pseudo-classes in the selector
  3606.      (= b)
  3607.    * count the number of element names in the selector (= c)
  3608.    * ignore pseudo-elements.
  3609.  
  3610. Concatenating the three numbers a-b-c (in a number system with a large base)
  3611. gives the specificity.
  3612.  
  3613. Example(s):
  3614.  
  3615. Some examples:
  3616.  
  3617. *             {}  /* a=0 b=0 c=0 -> specificity =   0 */
  3618. LI            {}  /* a=0 b=0 c=1 -> specificity =   1 */
  3619. UL LI         {}  /* a=0 b=0 c=2 -> specificity =   2 */
  3620. UL OL+LI      {}  /* a=0 b=0 c=3 -> specificity =   3 */
  3621. H1 + *[REL=up]{}  /* a=0 b=1 c=1 -> specificity =  11 */
  3622. UL OL LI.red  {}  /* a=0 b=1 c=3 -> specificity =  13 */
  3623. LI.red.level  {}  /* a=0 b=2 c=1 -> specificity =  21 */
  3624. #x34y         {}  /* a=1 b=0 c=0 -> specificity = 100 */
  3625.  
  3626. In HTML, values of an element's "style" attribute are style sheet rules.
  3627. These rules have no selectors, but for the purpose of step 3 of the cascade
  3628. algorithm, they are considered to have an ID selector (specificity: a=1,
  3629. b=0, c=0). For the purpose of step 4, they are considered to be after all
  3630. other rules.
  3631.  
  3632. <HEAD>
  3633. <STYLE type="text/css">
  3634.   #x97z { color: blue }
  3635. </STYLE>
  3636. </HEAD>
  3637. <BODY>
  3638. <P ID=x97z style="color: red">
  3639. </BODY>
  3640.  
  3641. In the above example, the color of the P element would be red. Although the
  3642. specificity is the same for both declarations, the declaration in the
  3643. "style" attribute will override the one in the STYLE element because of
  3644. cascading rule 4.
  3645.  
  3646. 6.4.4 Precedence of non-CSS presentational hints
  3647.  
  3648. The UA may choose to honor presentational hints from other sources than
  3649. style sheets, for example the FONT element or the "align" attribute in HTML.
  3650. If so, the non-CSS presentational hints must be translated to the
  3651. corresponding CSS rules with specificity equal to zero. The rules are
  3652. assumed to be at the start of the author style sheet and may be overridden
  3653. by subsequent style sheet rules.
  3654.  
  3655. Note. In a transition phase, this policy will make it easier for stylistic
  3656. attributes to coexist with style sheets.
  3657.  
  3658. Note. In CSS1, the non-CSS presentational hints were given a specificity
  3659. equal to 1, not 0. The change is due to the introduction of the universal
  3660. selector, which has a specificity of 0.
  3661.   ------------------------------------------------------------------------
  3662.   ------------------------------------------------------------------------
  3663.  
  3664.                                 7 Media types
  3665.  
  3666. Contents
  3667.  
  3668.    * 7.1 Introduction to media types
  3669.    * 7.2 Specifying media-dependent style sheets
  3670.         o 7.2.1 The @media rule
  3671.    * 7.3 Recognized media types
  3672.         o 7.3.1 Media groups
  3673.  
  3674. 7.1 Introduction to media types
  3675.  
  3676. One of the most important features of style sheets is that they specify how
  3677. a document is to be presented on different media: on the screen, on paper,
  3678. with a speech synthesizer, with a braille device, etc.
  3679.  
  3680. Certain CSS properties are only designed for certain media (e.g., the
  3681. 'cue-before' property for aural user agents). On occasion, however, style
  3682. sheets for different media types may share a property, but require different
  3683. values for that property. For example, the 'font-size' property is useful
  3684. both for screen and print media. However, the two media are different enough
  3685. to require different values for the common property; a document will
  3686. typically need a larger font on a computer screen than on paper. Experience
  3687. also shows that sans-serif fonts are easier to read on screen, while fonts
  3688. with serifs are easier to read on paper. For these reasons, it is necessary
  3689. to express that a style sheet -- or a section of a style sheet -- applies to
  3690. certain media types.
  3691.  
  3692. 7.2 Specifying media-dependent style sheets
  3693.  
  3694. There are currently two ways to specify media dependencies for style sheets:
  3695.  
  3696.    * Specify the target medium from a style sheet with the @media or @import
  3697.      at-rules.
  3698.  
  3699.      Example(s):
  3700.  
  3701.      @import url("loudvoice.css") aural;
  3702.      @media print {
  3703.        /* style sheet for print goes here */
  3704.      }
  3705.  
  3706.    * Specify the target medium within the document language. For example, in
  3707.      HTML 4.0 ([HTML40]), the "media" attribute on the LINK element
  3708.      specifies the target media of an external style sheet:
  3709.  
  3710.      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  3711.      <HTML>
  3712.         <HEAD>
  3713.            <TITLE>Link to a target medium</TITLE>
  3714.            <LINK rel="stylesheet" type="text/css"
  3715.               media="print, handheld" href="foo.css">
  3716.         </HEAD>
  3717.         <BODY>
  3718.            <P>The body...
  3719.         </BODY>
  3720.      </HTML>
  3721.  
  3722. The @import rule is defined in the chapter on the cascade.
  3723.  
  3724. 7.2.1 The @media rule
  3725.  
  3726. An @media rule specifies the target media types (separated by commas) of a
  3727. set of rules (delimited by curly braces). The @media construct allows style
  3728. sheet rules for various media in the same style sheet:
  3729.  
  3730.   @media print {
  3731.     BODY { font-size: 10pt }
  3732.   }
  3733.   @media screen {
  3734.     BODY { font-size: 12pt }
  3735.   }
  3736.   @media screen, print {
  3737.     BODY { line-height: 1.2 }
  3738.   }
  3739.  
  3740. 7.3 Recognized media types
  3741.  
  3742. A CSS media type names a set of CSS properties. A user agent that claims to
  3743. support a media type by name must implement all of the properties that apply
  3744. to that media type.
  3745.  
  3746. The names chosen for CSS media types reflect target devices for which the
  3747. relevant properties make sense. In the following list of CSS media types,
  3748. the parenthetical descriptions are not normative. They only give a sense of
  3749. what device the media type is meant to refer to.
  3750.  
  3751. all
  3752.      Suitable for all devices.
  3753. aural
  3754.      Intended for speech synthesizers. See the section on aural style sheets
  3755.      for details.
  3756. braille
  3757.      Intended for braille tactile feedback devices.
  3758. embossed
  3759.      Intended for paged braille printers.
  3760. handheld
  3761.      Intended for handheld devices (typically small screen, monochrome,
  3762.      limited bandwidth).
  3763. print
  3764.      Intended for paged, opaque material and for documents viewed on screen
  3765.      in print preview mode. Please consult the section on paged media for
  3766.      information about formatting issues that are specific to paged media.
  3767. projection
  3768.      Intended for projected presentations, for example projectors or print
  3769.      to transparencies. Please consult the section on paged media for
  3770.      information about formatting issues that are specific to paged media.
  3771. screen
  3772.      Intended primarily for color computer screens.
  3773. tty
  3774.      Intended for media using a fixed-pitch character grid, such as
  3775.      teletypes, terminals, or portable devices with limited display
  3776.      capabilities. Authors should not use pixel units with the "tty" media
  3777.      type.
  3778. tv
  3779.      Intended for television-type devices (low resolution, color,
  3780.      limited-scrollability screens, sound available).
  3781.  
  3782. Media type names are case-insensitive.
  3783.  
  3784. Due to rapidly changing technologies, CSS2 does not specify a definitive
  3785. list of media types that may be values for @media.
  3786.  
  3787. Note. Future versions of CSS may extend this list. Authors should not rely
  3788. on media type names that are not yet defined by a CSS specification.
  3789.  
  3790. 7.3.1 Media groups
  3791.  
  3792. Each CSS property definition specifies the media types for which the
  3793. property must be implemented by a conforming user agent. Since properties
  3794. generally apply to several media, the "Applies to media" section of each
  3795. property definition lists media groups rather than individual media types.
  3796. Each property applies to all media types in the media groups listed in its
  3797. definition.
  3798.  
  3799. CSS2 defines the following media groups:
  3800.  
  3801.    * continuous or paged. "Both" means that the property in question applies
  3802.      to both media groups.
  3803.    * visual, aural, or tactile.
  3804.    * grid (for character grid devices), or bitmap. "Both" means that the
  3805.      property in question applies to both media groups.
  3806.    * interactive (for devices that allow user interaction), or static (for
  3807.      those that don't). "Both" means that the property in question applies
  3808.      to both media groups.
  3809.    * all (includes all media types)
  3810.  
  3811. The following table shows the relationships between media groups and media
  3812. types:
  3813.  
  3814.                Relationship between media groups and media types
  3815.  
  3816.    Media
  3817.    Types                               Media Groups
  3818.            continuous/paged visual/aural/tactile grid/bitmap interactive/static
  3819.    aural      continuous            aural            N/A            both
  3820.   braille     continuous           tactile          grid            both
  3821.    emboss        paged             tactile          grid            both
  3822.   handheld       both              visual           both            both
  3823.    print         paged             visual          bitmap          static
  3824.  projection      paged             visual          bitmap          static
  3825.    screen     continuous           visual          bitmap           both
  3826.     tty       continuous           visual           grid            both
  3827.      tv          both           visual, aural      bitmap           both
  3828.   ------------------------------------------------------------------------
  3829.   ------------------------------------------------------------------------
  3830.  
  3831.                                  8 Box model
  3832.  
  3833. Contents
  3834.  
  3835.    * 8.1 Box dimensions
  3836.    * 8.2 Example of margins, padding, and borders
  3837.    * 8.3 Margin properties: 'margin-top', 'margin-right', 'margin-bottom',
  3838.      'margin-left', and 'margin'
  3839.         o 8.3.1 Collapsing margins
  3840.    * 8.4 Padding properties: 'padding-top', 'padding-right',
  3841.      'padding-bottom', 'padding-left', and 'padding'
  3842.    * 8.5 Border properties
  3843.         o 8.5.1 Border width: 'border-top-width', 'border-right-width',
  3844.           'border-bottom-width', 'border-left-width', and 'border-width'
  3845.         o 8.5.2 Border color: 'border-top-color', 'border-right-color',
  3846.           'border-bottom-color', 'border-left-color', and 'border-color'
  3847.         o 8.5.3 Border style: 'border-top-style', 'border-right-style',
  3848.           'border-bottom-style', 'border-left-style', and 'border-style'
  3849.         o 8.5.4 Border shorthand properties: 'border-top', 'border-bottom',
  3850.           'border-right', 'border-left', and 'border'
  3851.  
  3852. The CSS box model describes the rectangular boxes that are generated for
  3853. elements in the document tree and laid out according to the visual
  3854. formatting model. The page box is a special kind of box that is described in
  3855. detail in the section on paged media.
  3856.  
  3857. 8.1 Box dimensions
  3858.  
  3859. Each box has a content area (e.g., text, an image, etc.) and optional
  3860. surrounding padding, border, and margin areas; the size of each area is
  3861. specified by properties defined below. The following diagram shows how these
  3862. areas relate and the terminology used to refer to pieces of margin, border,
  3863. and padding:
  3864.  
  3865. [Image illustrating the relationship between content, padding, borders, and margins.]   [D]
  3866.  
  3867. The margin, border, and padding can be broken down into left, right, top,
  3868. and bottom segments (e.g., in the diagram, "LM" for left margin, "RP" for
  3869. right padding, "TB" for top border, etc.).
  3870.  
  3871. The perimeter of each of the four areas (content, padding, border, and
  3872. margin) is called an "edge", so each box has four edges:
  3873.  
  3874. content edge or inner edge
  3875.      The content edge surrounds the element's rendered content.
  3876. padding edge
  3877.      The padding edge surrounds the box padding. If the padding has 0 width,
  3878.      the padding edge is the same as the content edge. The padding edge of a
  3879.      box defines the edges of the containing block established by the box.
  3880. border edge
  3881.      The border edge surrounds the box's border. If the border has 0 width,
  3882.      the border edge is the same as the padding edge.
  3883. margin edge or outer edge
  3884.      The margin edge surrounds the box margin. If the margin has 0 width,
  3885.      the margin edge is the same as the border edge.
  3886.  
  3887. Each edge may be broken down into a left, right, top, and bottom edge.
  3888.  
  3889. The dimensions of the content area of a box -- the content width and content
  3890. height -- depend on several factors: whether the element generating the box
  3891. has the 'width' or 'height' property set, whether the box contains text or
  3892. other boxes, whether the box is a table, etc. Box widths and heights are
  3893. discussed in the chapter on visual formatting model details.
  3894.  
  3895. The box width is given by the sum of the left and right margins, border, and
  3896. padding, and the content width. The height is given by the sum of the top
  3897. and bottom margins, border, and padding, and the content height.
  3898.  
  3899. The background style of the various areas of a box are determined as
  3900. follows:
  3901.  
  3902.    * Content area: The 'background' property of the generating element.
  3903.    * Padding area: The 'background' property of the generating element.
  3904.    * Border area: The border properties of the generating element.
  3905.    * Margin area: Margins are always transparent.
  3906.  
  3907. 8.2 Example of margins, padding, and borders
  3908.  
  3909. This example illustrates how margins, padding, and borders interact. The
  3910. example HTML document:
  3911.  
  3912. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  3913. <HTML>
  3914.   <HEAD>
  3915.     <TITLE>Examples of margins, padding, and borders</TITLE>
  3916.     <STYLE type="text/css">
  3917.       UL {
  3918.         background: green;
  3919.         margin: 12px 12px 12px 12px;
  3920.         padding: 3px 3px 3px 3px;
  3921.                                      /* No borders set */
  3922.       }
  3923.       LI {
  3924.         color: black;                /* text color is black */
  3925.         background: gray;            /* Content, padding will be gray */
  3926.         margin: 12px 12px 12px 12px;
  3927.         padding: 12px 0px 12px 12px; /* Note 0px padding right */
  3928.         list-style: none             /* no glyphs before a list item */
  3929.                                      /* No borders set */
  3930.       }
  3931.       LI.withborder {
  3932.         border-style: dashed;
  3933.         border-width: medium;        /* sets border width on all sides */
  3934.         border-color: black;
  3935.       }
  3936.     </STYLE>
  3937.   </HEAD>
  3938.   <BODY>
  3939.     <UL>
  3940.       <LI>First element of list
  3941.       <LI class="withborder">Second element of list is longer
  3942.            to illustrate wrapping.
  3943.     </UL>
  3944.   </BODY>
  3945. </HTML>
  3946.  
  3947. results in a document tree with (among other relationships) a UL element
  3948. that has two LI children.
  3949.  
  3950. The first of the following diagrams illustrates what this example would
  3951. produce. The second illustrates the relationship between the margins,
  3952. padding, and borders of the UL elements and those of its children LI
  3953. elements.
  3954.  
  3955. [Image illustrating how parent and child margins, borders,and padding relate.]   [D]
  3956.  
  3957. Note that:
  3958.  
  3959.    * The content width for each LI box is calculated top-down; the
  3960.      containing block for each LI box is established by the UL element.
  3961.    * The height of each LI box is given by its content height, plus top and
  3962.      bottom padding, borders, and margins. Note that vertical margins
  3963.      between the LI boxes collapse.
  3964.    * The right padding of the LI boxes has been set to zero width (the
  3965.      'padding' property). The effect is apparent in the second illustration.
  3966.    * The margins of the LI boxes are transparent -- margins are always
  3967.      transparent -- so the background color (green) of the UL padding and
  3968.      content areas shines through them.
  3969.    * The second LI element specifies a dashed border (the 'border-style'
  3970.      property).
  3971.  
  3972. 8.3 Margin properties: 'margin-top', 'margin-right', 'margin-bottom',
  3973. 'margin-left', and 'margin'
  3974.  
  3975. Margin properties specify the width of the margin area of a box. The
  3976. 'margin' shorthand property sets the margin for all four sides while the
  3977. other margin properties only set their respective side.
  3978.  
  3979. The properties defined in this section refer to the <margin-width> value
  3980. type, which may take one of the following values:
  3981.  
  3982. <length>
  3983.      Specifies a fixed width.
  3984. <percentage>
  3985.      The percentage is calculated with respect to the width of the generated
  3986.      box's containing block. This is true for 'margin-top' and
  3987.      'margin-bottom', except in the page context, where percentages refer to
  3988.      page box height.
  3989. auto
  3990.      See the section on computing widths and margins for behavior.
  3991.  
  3992. Negative values for margin properties are allowed, but there may be
  3993. implementation-specific limits.
  3994.  
  3995. 'margin-top', 'margin-right', 'margin-bottom', 'margin-left'
  3996.      Value:         <margin-width> | inherit
  3997.      Initial:       0
  3998.      Applies to:    all elements
  3999.      Inherited:     no
  4000.      Percentages:   refer to width of containing block
  4001.      Media:         visual
  4002.  
  4003. These properties set the top, right, bottom, and left margin of a box.
  4004.  
  4005. Example(s):
  4006.  
  4007. H1 { margin-top: 2em }
  4008.  
  4009. 'margin'
  4010.      Value:         <margin-width>{1,4} | inherit
  4011.      Initial:       not defined for shorthand properties
  4012.      Applies to:    all elements
  4013.      Inherited:     no
  4014.      Percentages:   refer to width of containing block
  4015.      Media:         visual
  4016.  
  4017. The 'margin' property is a shorthand property for setting 'margin-top',
  4018. 'margin-right', 'margin-bottom', and 'margin-left' at the same place in the
  4019. style sheet.
  4020.  
  4021. If there is only one value, it applies to all sides. If there are two
  4022. values, the top and bottom margins are set to the first value and the right
  4023. and left margins are set to the second. If there are three values, the top
  4024. is set to the first value, the left and right are set to the second, and the
  4025. bottom is set to the third. If there are four values, they apply to the top,
  4026. right, bottom, and left, respectively.
  4027.  
  4028. Example(s):
  4029.  
  4030. BODY { margin: 2em }         /* all margins set to 2em */
  4031. BODY { margin: 1em 2em }     /* top & bottom = 1em, right & left = 2em */
  4032. BODY { margin: 1em 2em 3em } /* top=1em, right=2em, bottom=3em, left=2em */
  4033.  
  4034. The last rule of the example above is equivalent to the example below:
  4035.  
  4036. BODY {
  4037.   margin-top: 1em;
  4038.   margin-right: 2em;
  4039.   margin-bottom: 3em;
  4040.   margin-left: 2em;        /* copied from opposite side (right) */
  4041. }
  4042.  
  4043. 8.3.1 Collapsing margins
  4044.  
  4045. In this specification, the expression collapsing margins means that
  4046. adjoining margins (no padding or border areas separate them) of two or more
  4047. boxes (which may be next to one another or nested) combine to form a single
  4048. margin.
  4049.  
  4050. In CSS2, horizontal margins never collapse.
  4051.  
  4052. Vertical margins may collapse between certain boxes:
  4053.  
  4054.    * Two or more adjoining vertical margins of block boxes in the normal
  4055.      flow collapse. The resulting margin width is the maximum of the
  4056.      adjoining margin widths. In the case of negative margins, the absolute
  4057.      maximum of the negative adjoining margins is deducted from the maximum
  4058.      of the positive adjoining margins. If there are no positive margins,
  4059.      the absolute maximum of the negative adjoining margins is deducted from
  4060.      zero.
  4061.    * Vertical margins between a floated box and any other box do not
  4062.      collapse.
  4063.    * Margins of absolutely and relatively positioned boxes do not collapse.
  4064.  
  4065. Please consult the examples of margin, padding, and borders for an
  4066. illustration of collapsed margins.
  4067.  
  4068. 8.4 Padding properties: 'padding-top', 'padding-right', 'padding-bottom',
  4069. 'padding-left', and 'padding'
  4070.  
  4071. The padding properties specify the width of the padding area of a box. The
  4072. 'padding' shorthand property sets the padding for all four sides while the
  4073. other padding properties only set their respective side.
  4074.  
  4075. The properties defined in this section refer to the <padding-width> value
  4076. type, which may take one of the following values:
  4077.  
  4078. <length>
  4079.      Specifies a fixed width.
  4080. <percentage>
  4081.      The percentage is calculated with respect to the width of the generated
  4082.      box's containing block, even for 'padding-top' and 'padding-bottom'.
  4083.  
  4084. Unlike margin properties, values for padding values cannot be negative. Like
  4085. margin properties, percentage values for padding properties refer to the
  4086. width of the generated box's containing block.
  4087.  
  4088. 'padding-top', 'padding-right', 'padding-bottom', 'padding-left'
  4089.      Value:         <padding-width> | inherit
  4090.      Initial:       0
  4091.      Applies to:    all elements
  4092.      Inherited:     no
  4093.      Percentages:   refer to width of containing block
  4094.      Media:         visual
  4095.  
  4096. These properties set the top, right, bottom, and left padding of a box.
  4097.  
  4098. Example(s):
  4099.  
  4100. BLOCKQUOTE { padding-top: 0.3em }
  4101.  
  4102. 'padding'
  4103.      Value:         <padding-width>{1,4} | inherit
  4104.      Initial:       not defined for shorthand properties
  4105.      Applies to:    all elements
  4106.      Inherited:     no
  4107.      Percentages:   refer to width of containing block
  4108.      Media:         visual
  4109.  
  4110. The 'padding' property is a shorthand property for setting 'padding-top',
  4111. 'padding-right', 'padding-bottom', and 'padding-left' at the same place in
  4112. the style sheet.
  4113.  
  4114. If there is only one value, it applies to all sides. If there are two
  4115. values, the top and bottom paddings are set to the first value and the right
  4116. and left paddings are set to the second. If there are three values, the top
  4117. is set to the first value, the left and right are set to the second, and the
  4118. bottom is set to the third. If there are four values, they apply to the top,
  4119. right, bottom, and left, respectively.
  4120.  
  4121. The surface color or image of the padding area is specified via the
  4122. 'background' property:
  4123.  
  4124. Example(s):
  4125.  
  4126. H1 {
  4127.   background: white;
  4128.   padding: 1em 2em;
  4129. }
  4130.  
  4131. The example above specifies a '1em' vertical padding ('padding-top' and
  4132. 'padding-bottom') and a '2em' horizontal padding ('padding-right' and
  4133. 'padding-left'). The 'em' unit is relative to the element's font size: '1em'
  4134. is equal to the size of the font in use.
  4135.  
  4136. 8.5 Border properties
  4137.  
  4138. The border properties specify the width, color, and style of the border area
  4139. of a box. These properties apply to all elements.
  4140.  
  4141. Note. Notably for HTML, user agents may render borders for certain elements
  4142. (e.g., buttons, menus, etc.) differently than for "ordinary" elements.
  4143.  
  4144. 8.5.1 Border width: 'border-top-width', 'border-right-width',
  4145. 'border-bottom-width', 'border-left-width', and 'border-width'
  4146.  
  4147. The border width properties specify the width of the border area. The
  4148. properties defined in this section refer to the <border-width> value type,
  4149. which may take one of the following values:
  4150.  
  4151. thin
  4152.      A thin border.
  4153. medium
  4154.      A medium border.
  4155. thick
  4156.      A thick border.
  4157. <length>
  4158.      The border's thickness has an explicit value. Explicit border widths
  4159.      cannot be negative.
  4160.  
  4161. The interpretation of the first three values depends on the user agent. The
  4162. following relationships must hold, however:
  4163.  
  4164. 'thin' <='medium' <= 'thick'.
  4165.  
  4166. Furthermore, these widths must be constant throughout a document.
  4167.  
  4168. 'border-top-width', 'border-right-width', 'border-bottom-width',
  4169. 'border-left-width'
  4170.      Value:         <border-width> | inherit
  4171.      Initial:       medium
  4172.      Applies to:    all elements
  4173.      Inherited:     no
  4174.      Percentages:   N/A
  4175.      Media:         visual
  4176.  
  4177. These properties set the width of the top, right, bottom, and left border of
  4178. a box.
  4179.  
  4180. 'border-width'
  4181.      Value:         <border-width>{1,4} | inherit
  4182.      Initial:       see individual properties
  4183.      Applies to:    all elements
  4184.      Inherited:     no
  4185.      Percentages:   N/A
  4186.      Media:         visual
  4187.  
  4188. This property is a shorthand property for setting 'border-top-width',
  4189. 'border-right-width', 'border-bottom-width', and 'border-left-width' at the
  4190. same place in the style sheet.
  4191.  
  4192. If there is only one value, it applies to all sides. If there are two
  4193. values, the top and bottom borders are set to the first value and the right
  4194. and left are set to the second. If there are three values, the top is set to
  4195. the first value, the left and right are set to the second, and the bottom is
  4196. set to the third. If there are four values, they apply to the top, right,
  4197. bottom, and left, respectively.
  4198.  
  4199. Example(s):
  4200.  
  4201. In the examples below, the comments indicate the resulting widths of the
  4202. top, right, bottom, and left borders:
  4203.  
  4204. H1 { border-width: thin }                   /* thin thin thin thin */
  4205. H1 { border-width: thin thick }             /* thin thick thin thick */
  4206. H1 { border-width: thin thick medium }      /* thin thick medium thick */
  4207.  
  4208. 8.5.2 Border color: 'border-top-color', 'border-right-color',
  4209. 'border-bottom-color', 'border-left-color', and 'border-color'
  4210.  
  4211. The border color properties specify the color of a box's border.
  4212.  
  4213. 'border-top-color', 'border-right-color', 'border-bottom-color',
  4214. 'border-left-color'
  4215.      Value:         <color> | inherit
  4216.      Initial:       the value of the 'color' property
  4217.      Applies to:    all elements
  4218.      Inherited:     no
  4219.      Percentages:   N/A
  4220.      Media:         visual
  4221.  
  4222. 'border-color'
  4223.      Value:         <color>{1,4} | transparent | inherit
  4224.      Initial:       see individual properties
  4225.      Applies to:    all elements
  4226.      Inherited:     no
  4227.      Percentages:   N/A
  4228.      Media:         visual
  4229.  
  4230. The 'border-color' property sets the color of the four borders. Values have
  4231. the following meanings:
  4232.  
  4233. <color>
  4234.      Specifies a color value.
  4235. transparent
  4236.      The border is transparent (though it may have width).
  4237.  
  4238. The 'border-color' property can have from one to four values, and the values
  4239. are set on the different sides as for 'border-width'.
  4240.  
  4241. If an element's border color is not specified with a border property, user
  4242. agents must use the value of the element's 'color' property as the computed
  4243. value for the border color.
  4244.  
  4245. Example(s):
  4246.  
  4247. In this example, the border will be a solid black line.
  4248.  
  4249. P {
  4250.   color: black;
  4251.   background: white;
  4252.   border: solid;
  4253. }
  4254.  
  4255. 8.5.3 Border style: 'border-top-style', 'border-right-style',
  4256. 'border-bottom-style', 'border-left-style', and 'border-style'
  4257.  
  4258. The border style properties specify the line style of a box's border (solid,
  4259. double, dashed, etc.). The properties defined in this section refer to the
  4260. <border-style> value type, which make take one of the following:
  4261.  
  4262. none
  4263.      No border. This value forces the computed value of 'border-width' to be
  4264.      '0'.
  4265. hidden
  4266.      Same as 'none', except in terms of border conflict resolution for table
  4267.      elements.
  4268. dotted
  4269.      The border is a series of dots.
  4270. dashed
  4271.      The border is a series of short line segments.
  4272. solid
  4273.      The border is a single line segment.
  4274. double
  4275.      The border is two solid lines. The sum of the two lines and the space
  4276.      between them equals the value of 'border-width'.
  4277. groove
  4278.      The border looks as though it were carved into the canvas.
  4279. ridge
  4280.      The opposite of 'grove': the border looks as though it were coming out
  4281.      of the canvas.
  4282. inset
  4283.      The border makes the entire box look as though it were embedded in the
  4284.      canvas.
  4285. outset
  4286.      The opposite of 'inset': the border makes the entire box look as though
  4287.      it were coming out of the canvas.
  4288.  
  4289. All borders are drawn on top of the box's background. The color of borders
  4290. drawn for values of 'groove', 'ridge', 'inset', and 'outset' depends on the
  4291. element's 'color' property.
  4292.  
  4293. Conforming HTML user agents may interpret 'dotted', 'dashed', 'double',
  4294. 'groove', 'ridge', 'inset', and 'outset' to be 'solid'.
  4295.  
  4296. 'border-top-style', 'border-right-style', 'border-bottom-style',
  4297. 'border-left-style'
  4298.      Value:         <border-style> | inherit
  4299.      Initial:       none
  4300.      Applies to:    all elements
  4301.      Inherited:     no
  4302.      Percentages:   N/A
  4303.      Media:         visual
  4304.  
  4305. 'border-style'
  4306.      Value:         <border-style>{1,4} | inherit
  4307.      Initial:       see individual properties
  4308.      Applies to:    all elements
  4309.      Inherited:     no
  4310.      Percentages:   N/A
  4311.      Media:         visual
  4312.  
  4313. The 'border-style' property sets the style of the four borders. It can have
  4314. from one to four values, and the values are set on the different sides as
  4315. for 'border-width' above.
  4316.  
  4317. Example(s):
  4318.  
  4319. #xy34 { border-style: solid dotted }
  4320.  
  4321. In the above example, the horizontal borders will be 'solid' and the
  4322. vertical borders will be 'dotted'.
  4323.  
  4324. Since the initial value of the border styles is 'none', no borders will be
  4325. visible unless the border style is set.
  4326.  
  4327. 8.5.4 Border shorthand properties: 'border-top', 'border-bottom',
  4328. 'border-right', 'border-left', and 'border'
  4329.  
  4330. 'border-top', 'border-right', 'border-bottom', 'border-left'
  4331.      Value:         [ <'border-top-width'> || <'border-style'> || <color> ]
  4332.                     | inherit
  4333.      Initial:       see individual properties
  4334.      Applies to:    all elements
  4335.      Inherited:     no
  4336.      Percentages:   N/A
  4337.      Media:         visual
  4338.  
  4339. This is a shorthand property for setting the width, style, and color of the
  4340. top, right, bottom, and left border of a box.
  4341.  
  4342. Example(s):
  4343.  
  4344. H1 { border-bottom: thick solid red }
  4345.  
  4346. The above rule will set the width, style, and color of the border below the
  4347. H1 element. Omitted values are set to their initial values. Since the
  4348. following rule does not specify a border color, the border will have the
  4349. color specified by the 'color' property:
  4350.  
  4351. H1 { border-bottom: thick solid }
  4352.  
  4353. 'border'
  4354.      Value:         [ <'border-width'> || <'border-style'> || <color> ] |
  4355.                     inherit
  4356.      Initial:       see individual properties
  4357.      Applies to:    all elements
  4358.      Inherited:     no
  4359.      Percentages:   N/A
  4360.      Media:         visual
  4361.  
  4362. The 'border' property is a shorthand property for setting the same width,
  4363. color, and style for all four borders of a box. Unlike the shorthand
  4364. 'margin' and 'padding' properties, the 'border' property cannot set
  4365. different values on the four borders. To do so, one or more of the other
  4366. border properties must be used.
  4367.  
  4368. Example(s):
  4369.  
  4370. For example, the first rule below is equivalent to the set of four rules
  4371. shown after it:
  4372.  
  4373. P { border: solid red }
  4374. P {
  4375.   border-top: solid red;
  4376.   border-right: solid red;
  4377.   border-bottom: solid red;
  4378.   border-left: solid red
  4379. }
  4380.  
  4381. Since, to some extent, the properties have overlapping functionality, the
  4382. order in which the rules are specified is important.
  4383.  
  4384. Example(s):
  4385.  
  4386. Consider this example:
  4387.  
  4388. BLOCKQUOTE {
  4389.   border-color: red;
  4390.   border-left: double;
  4391.   color: black
  4392. }
  4393.  
  4394. In the above example, the color of the left border is black, while the other
  4395. borders are red. This is due to 'border-left' setting the width, style, and
  4396. color. Since the color value is not given by the 'border-left' property, it
  4397. will be taken from the 'color' property. The fact that the 'color' property
  4398. is set after the 'border-left' property is not relevant.
  4399.   ------------------------------------------------------------------------
  4400.   ------------------------------------------------------------------------
  4401.  
  4402.                           9 Visual formatting model
  4403.  
  4404. Contents
  4405.  
  4406.    * 9.1 Introduction to the visual formatting model
  4407.         o 9.1.1 The viewport
  4408.         o 9.1.2 Containing blocks
  4409.    * 9.2 Controlling box generation
  4410.         o 9.2.1 Block-level elements and block boxes
  4411.              + Anonymous block boxes
  4412.         o 9.2.2 Inline-level elements and inline boxes
  4413.              + Anonymous inline boxes
  4414.         o 9.2.3 Compact boxes
  4415.         o 9.2.4 Run-in boxes
  4416.         o 9.2.5 The 'display' property
  4417.    * 9.3 Positioning schemes
  4418.         o 9.3.1 Choosing a positioning scheme: 'position' property
  4419.         o 9.3.2 Box offsets: 'top', 'right', 'bottom', 'left'
  4420.    * 9.4 Normal flow
  4421.         o 9.4.1 Block formatting context
  4422.         o 9.4.2 Inline formatting context
  4423.         o 9.4.3 Relative positioning
  4424.    * 9.5 Floats
  4425.         o 9.5.1 Positioning the float: the 'float' property
  4426.         o 9.5.2 Controlling flow next to floats: the 'clear' property
  4427.    * 9.6 Absolute positioning
  4428.         o 9.6.1 Fixed positioning
  4429.    * 9.7 Relationships between 'display', 'position', and 'float'
  4430.    * 9.8 Comparison of normal flow, floats, and absolute positioning
  4431.         o 9.8.1 Normal flow
  4432.         o 9.8.2 Relative positioning
  4433.         o 9.8.3 Floating a box
  4434.         o 9.8.4 Absolute positioning
  4435.    * 9.9 Layered presentation
  4436.         o 9.9.1 Specifying the stack level: the 'z-index' property
  4437.    * 9.10 Text direction: the 'direction' and 'unicode-bidi' properties
  4438.  
  4439. 9.1 Introduction to the visual formatting model
  4440.  
  4441. This chapter and the next describe the visual formatting model: how user
  4442. agents process the document tree for visual media.
  4443.  
  4444. In the visual formatting model, each element in the document tree generates
  4445. zero or more boxes according to the box model. The layout of these boxes is
  4446. governed by:
  4447.  
  4448.    * box dimensions and type.
  4449.    * positioning scheme (normal flow, float, and absolute).
  4450.    * relationships between elements in the document tree.
  4451.    * external information (e.g., viewport size, intrinsic dimensions of
  4452.      images, etc.).
  4453.  
  4454. The properties defined in this chapter and the next apply to both continuous
  4455. media and paged media. However, the meanings of the margin properties vary
  4456. when applied to paged media (see the page model for details).
  4457.  
  4458. The visual formatting model does not specify all aspects of formatting
  4459. (e.g., it does not specify a letter-spacing algorithm). Conforming user
  4460. agents may behave differently for those formatting issues not covered by
  4461. this specification.
  4462.  
  4463. 9.1.1 The viewport
  4464.  
  4465. User agents for continuous media generally offer users a viewport (a window
  4466. or other viewing area on the screen) through which users consult a document.
  4467. User agents may change the document's layout when the viewport is resized
  4468. (see the initial containing block). When the viewport is smaller than the
  4469. document's initial containing block, the user agent should offer a scrolling
  4470. mechanism. There is at most one viewport per canvas, but user agents may
  4471. render to more than one canvas (i.e., provide different views of the same
  4472. document).
  4473.  
  4474. 9.1.2 Containing blocks
  4475.  
  4476. In CSS2, many box positions and sizes are calculated with respect to the
  4477. edges of a rectangular box called a containing block. In general, generated
  4478. boxes act as containing blocks for descendant boxes; we say that a box
  4479. "establishes" the containing block for its descendants. The phrase "a box's
  4480. containing block" means "the containing block in which the box lives," not
  4481. the one it generates.
  4482.  
  4483. Each box is given a position with respect to its containing block, but it is
  4484. not confined by this containing block; it may overflow.
  4485.  
  4486. The root of the document tree generates a box that serves as the initial
  4487. containing block for subsequent layout.
  4488.  
  4489. The width of the initial containing block may be specified with the 'width'
  4490. property for the root element. If this property has the value 'auto', the
  4491. user agent supplies the initial width (e.g., the user agent uses the current
  4492. width of the viewport).
  4493.  
  4494. The height of the initial containing block may be specified with the
  4495. 'height' property for the root element. If this property has the value
  4496. 'auto', the containing block height will grow to accommodate the document's
  4497. content.
  4498.  
  4499. The initial containing block cannot be positioned or floated (i.e., user
  4500. agents ignore the 'position' and 'float' properties for the root element).
  4501.  
  4502. The details of how a containing block's dimensions are calculated are
  4503. described in the next chapter.
  4504.  
  4505. 9.2 Controlling box generation
  4506.  
  4507. The following sections describe the types of boxes that may be generated in
  4508. CSS2. A box's type affects, in part, its behavior in the visual formatting
  4509. model. The 'display' property, described below, specifies a box's type.
  4510.  
  4511. 9.2.1 Block-level elements and block boxes
  4512.  
  4513. Block-level elements are those elements of the source document that are
  4514. formatted visually as blocks (e.g., paragraphs). Several values of the
  4515. 'display' property make an element block-level: 'block', 'list-item',
  4516. 'compact' and 'run-in' (part of the time; see compact and run-in boxes), and
  4517. 'table'.
  4518.  
  4519. Block-level elements generate a principal block box that only contains block
  4520. boxes. The principal block box establishes the containing block for
  4521. descendant boxes and generated content and is also the box involved in any
  4522. positioning scheme. Principal block boxes participate in a block formatting
  4523. context.
  4524.  
  4525. Some block-level elements generate additional boxes outside of the principal
  4526. box: 'list-item' elements and those with markers. These additional boxes are
  4527. placed with respect to the principal box.
  4528.  
  4529. Anonymous block boxes
  4530.  
  4531. In a document like this:
  4532.  
  4533. <DIV>
  4534.   Some text
  4535.   <P>More text
  4536. </DIV>
  4537.  
  4538. (and assuming the DIV and the P both have 'display: block'), the DIV appears
  4539. to have both inline content and block content. To make it easier to define
  4540. the formatting, we assume that there is an anonymous block box around "Some
  4541. text".
  4542.  
  4543. [diagram showing the threeboxes for the example above]   [D]
  4544.  
  4545. Diagram showing the three boxes, of which one is anonymous, for the example
  4546. above.
  4547.  
  4548. In other words: if a block box (such as that generated for the DIV above)
  4549. has another block box inside it (such as the P above), then we force it to
  4550. have only block boxes inside it, by wrapping any inline boxes in an
  4551. anonymous block box.
  4552.  
  4553. Example(s):
  4554.  
  4555. This model would apply in the following example if the following rules:
  4556.  
  4557. /* Note: HTML UAs may not respect these rules */
  4558. BODY { display: inline }
  4559. P    { display: block }
  4560.  
  4561. were used with this HTML document:
  4562.  
  4563. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  4564. <HEAD>
  4565. <TITLE>Anonymous text interrupted by a block</TITLE>
  4566. </HEAD>
  4567. <BODY>
  4568. This is anonymous text before the P.
  4569. <P>This is the content of P.</>
  4570. This is anonymous text after the P.
  4571. </BODY>
  4572.  
  4573. The BODY element contains a chunk (C1) of anonymous text followed by a
  4574. block-level element followed by another chunk (C2) of anonymous text. The
  4575. resulting boxes would be an anonymous block box for BODY, containing an
  4576. anonymous block box around C1, the P block box, and another anonymous block
  4577. box around C2.
  4578.  
  4579. The properties of anonymous boxes are inherited from the enclosing
  4580. non-anonymous box (in the example: the one for DIV). Non-inherited
  4581. properties have their initial value. For example, the font of the anonymous
  4582. box is inherited from the DIV, but the margins will be 0.
  4583.  
  4584. 9.2.2 Inline-level elements and inline boxes
  4585.  
  4586. Inline-level elements are those elements of the source document that do not
  4587. form new blocks of content; the content is distributed in lines (e.g.,
  4588. emphasized pieces of text within a paragraph, inline images, etc.). Several
  4589. values of the 'display' property make an element inline: 'inline',
  4590. 'inline-table', 'compact' and 'run-in' (part of the time; see compact and
  4591. run-in boxes). Inline-level elements generate inline boxes.
  4592.  
  4593. Inline boxes may participate in several formatting contexts:
  4594.  
  4595.    * Within a block box, an inline boxes participate in an inline formatting
  4596.      context.
  4597.    * A compact inline box is given a position in the margin of a block box.
  4598.    * Marker boxes are also given positions outside of a block box.
  4599.  
  4600. Anonymous inline boxes
  4601.  
  4602. In a document like this:
  4603.  
  4604. <P>Some <EM>emphasized</em> text</P>
  4605.  
  4606. The P generates a block box, with several inline boxes inside it. The box
  4607. for "emphasized" is an inline box generated by an inline element (EM), but
  4608. the other boxes ("Some" and "text") are inline boxes generated by a
  4609. block-level element (P). The latter are called anonymous inline boxes,
  4610. because they don't have an associated inline-level element.
  4611.  
  4612. Such anonymous inline boxes inherit inheritable properties from their block
  4613. parent box. Non-inherited properties have their initial value. In the
  4614. example, the color of the anonymous initial boxes is inherited from the P,
  4615. but the background is transparent.
  4616.  
  4617. If it is clear from the context which type of anonymous box is meant, both
  4618. anonymous inline boxes and anonymous block boxes are simply called anonymous
  4619. boxes in this specification.
  4620.  
  4621. There are more types of anonymous boxes that arise when formatting tables.
  4622.  
  4623. 9.2.3 Compact boxes
  4624.  
  4625. A compact box behaves as follows:
  4626.  
  4627.    * If a block box (that does not float and is not absolutely positioned)
  4628.      follows the compact box, the compact box is formatted like a one-line
  4629.      inline box. The resulting box width is compared to one of the side
  4630.      margins of the block box. The choice of left or right margin is
  4631.      determined by the 'direction' specified for the element producing the
  4632.      containing block for the compact box and following box. If the inline
  4633.      box width is less than or equal to the margin, the inline box is given
  4634.      a position in the margin as described immediately below.
  4635.    * Otherwise, the compact box becomes a block box.
  4636.  
  4637. The compact box is given a position in the margin as follows: it is outside
  4638. (to the left or right) of the first line box of the block, but it affects
  4639. the calculation of that line box's height. The 'vertical-align' property of
  4640. the compact box determines the vertical position of the compact box relative
  4641. to that line box. The horizontal position of the compact box is always in
  4642. the margin of the block box.
  4643.  
  4644. An element that cannot be formatted on one line cannot be placed in the
  4645. margin of the following block. For example, a 'compact' element in HTML that
  4646. contains a BR element will always be formatted as a block box (assuming the
  4647. default style for BR, which inserts a newline). For placing multi-line texts
  4648. in the margin, the 'float' property is often more appropriate.
  4649.  
  4650. The following example illustrates a compact box.
  4651.  
  4652. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  4653. <HTML>
  4654.   <HEAD>
  4655.     <TITLE>A compact box example</TITLE>
  4656.     <STYLE type="text/css">
  4657.       DT { display: compact }
  4658.       DD { margin-left: 4em }
  4659.     </STYLE>
  4660.   </HEAD>
  4661.   <BODY>
  4662.     <DL>
  4663.       <DT>Short
  4664.         <DD><P>Description goes here.
  4665.       <DT>too long for the margin
  4666.         <DD><P>Description goes here.
  4667.     </DL>
  4668.   </BODY>
  4669. </HTML>
  4670.  
  4671. This example might be formatted as:
  4672.  
  4673. short    Description goes here
  4674.  
  4675. too long for the margin
  4676.          Description goes here
  4677.  
  4678. The 'text-align' property can be used to align the compact element inside
  4679. the margin: against the left edge of the margin ('left'), against the right
  4680. edge ('right'), or centered in the margin ('center'). The value 'justify'
  4681. doesn't apply, and is handled as either 'left' or 'right', depending on the
  4682. 'direction' of the block-level element in whose margin the compact element
  4683. is formatted. ('left' if the direction is 'ltr', 'right' if it is 'rtl'.)
  4684.  
  4685. Please consult the section on generated content for information about how
  4686. compact boxes interact with generated content.
  4687.  
  4688. 9.2.4 Run-in boxes
  4689.  
  4690. A run-in box behaves as follows:
  4691.  
  4692.    * If a block box (that does not float and is not absolutely positioned)
  4693.      follows the run-in box, the run-in box becomes the first inline box of
  4694.      the block box.
  4695.    * Otherwise, the run-in box becomes a block box.
  4696.  
  4697. A 'run-in' box is useful for run-in headers, as in this example:
  4698.  
  4699. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  4700. <HTML>
  4701.   <HEAD>
  4702.     <TITLE>A run-in box example</TITLE>
  4703.     <STYLE type="text/css">
  4704.       H3 { display: run-in }
  4705.     </STYLE>
  4706.   </HEAD>
  4707.   <BODY>
  4708.     <H3>A run-in heading.</H3>
  4709.     <P>And a paragraph of text that
  4710.        follows it.
  4711.   </BODY>
  4712. </HTML>
  4713.  
  4714. This example might be formatted as:
  4715.  
  4716.   A run-in heading. And a
  4717.   paragraph of text that
  4718.   follows it.
  4719.  
  4720. The properties of the run-in element are inherited from its parent in the
  4721. source tree, not from the block box it visually becomes part of.
  4722.  
  4723. Please consult the section on generated content for information about how
  4724. run-in boxes interact with generated content.
  4725.  
  4726. 9.2.5 The 'display' property
  4727.  
  4728. 'display'
  4729.      Value:         inline | block | list-item | run-in | compact | marker |
  4730.                     table | inline-table | table-row-group |
  4731.                     table-header-group | table-footer-group | table-row |
  4732.                     table-column-group | table-column | table-cell |
  4733.                     table-caption | none | inherit
  4734.      Initial:       inline
  4735.      Applies to:    all elements
  4736.      Inherited:     no
  4737.      Percentages:   N/A
  4738.      Media:         all
  4739.  
  4740. The values of this property have the following meanings:
  4741.  
  4742. block
  4743.      This value causes an element to generate a principal block box.
  4744. inline
  4745.      This value causes an element to generate one or more inline boxes.
  4746. list-item
  4747.      This value causes an element (e.g., LI in HTML) to generate a principal
  4748.      block box and a list-item inline box. For information about lists and
  4749.      examples of list formatting, please consult the section on lists.
  4750. marker
  4751.      This value declares generated content before or after a box to be a
  4752.      marker. This value should only be used with :before and :after
  4753.      pseudo-elements attached to block-level elements. In other cases, this
  4754.      value is interpreted as 'inline'. Please consult the section on markers
  4755.      for more information.
  4756. none
  4757.      This value causes an element to generate no boxes in the formatting
  4758.      structure (i.e., the element has no effect on layout). Descendant
  4759.      elements do not generate any boxes either; this behavior cannot be
  4760.      overridden by setting the 'display' property on the descendants.
  4761.  
  4762.      Please note that a display of 'none' does not create an invisible box;
  4763.      it creates no box at all. CSS includes mechanisms that enable an
  4764.      element to generate boxes in the formatting structure that affect
  4765.      formatting but are not visible themselves. Please consult the section
  4766.      on visibility for details.
  4767. run-in and compact
  4768.      These values create either block or inline boxes, depending on context.
  4769.      Properties apply to run-in and compact boxes based on their final
  4770.      status (inline-level or block-level). For example, the 'white-space'
  4771.      property only applies if the box becomes a block box.
  4772. table, inline-table, table-row-group, table-column, table-column-group,
  4773. table-header-group, table-footer-group, table-row, table-cell, and
  4774. table-caption
  4775.      These values cause an element to behave like a table element (subject
  4776.      to restrictions described in the chapter on tables).
  4777.  
  4778. Note that although the initial value of 'display' is 'inline', rules in the
  4779. user agent's default style sheet may override this value. See the sample
  4780. style sheet for HTML 4.0 in the appendix.
  4781.  
  4782. Example(s):
  4783.  
  4784. Here are some examples of the 'display' property:
  4785.  
  4786. P   { display: block }
  4787. EM  { display: inline }
  4788. LI  { display: list-item }
  4789. IMG { display: none }      /* Don't display images */
  4790.  
  4791. Conforming HTML user agents may ignore the 'display' property.
  4792.  
  4793. 9.3 Positioning schemes
  4794.  
  4795. In CSS2, a box may be laid out according to three positioning schemes:
  4796.  
  4797.   1. Normal flow. In CSS2, normal flow includes block formatting of block
  4798.      boxes, inline formatting of inline boxes, relative positioning of block
  4799.      or inline boxes, and positioning of compact and run-in boxes.
  4800.   2. Floats. In the float model, a box is first laid out according to the
  4801.      normal flow, then taken out of the flow and shifted to the left or
  4802.      right as far as possible. Content may flow along the side of a float.
  4803.   3. Absolute positioning. In the absolute positioning model, a box is
  4804.      removed from the normal flow entirely (it has no impact on later
  4805.      siblings) and assigned a position with respect to a containing block.
  4806.  
  4807. Note. CSS2's positioning schemes help authors make their documents more
  4808. accessible by allowing them to avoid mark-up tricks (e.g., invisible images)
  4809. used for layout effects.
  4810.  
  4811. 9.3.1 Choosing a positioning scheme: 'position' property
  4812.  
  4813. The 'position' and 'float' properties determine which of the CSS2
  4814. positioning algorithms is used to calculate the position of a box.
  4815.  
  4816. 'position'
  4817.      Value:         static | relative | absolute | fixed | inherit
  4818.      Initial:       static
  4819.      Applies to:    all elements, but not to generated content
  4820.      Inherited:     no
  4821.      Percentages:   N/A
  4822.      Media:         visual
  4823.  
  4824. The values of this property have the following meanings:
  4825.  
  4826. static
  4827.      The box is a normal box, laid out according to the normal flow. The
  4828.      'left' and 'top' properties do not apply.
  4829. relative
  4830.      The box's position is calculated according to the normal flow (this is
  4831.      called the position in normal flow). Then the box is offset relative to
  4832.      its normal position. When a box B is relatively positioned, the
  4833.      position of the following box is calculated as though B were not
  4834.      offset.
  4835. absolute
  4836.      The box's position (and possibly size) is specified with the 'left',
  4837.      'right', 'top', and 'bottom' properties. These properties specify
  4838.      offsets with respect to the box's containing block. Absolutely
  4839.      positioned boxes are taken out of the normal flow. This means they have
  4840.      no impact on the layout of later siblings. Also, though absolutely
  4841.      positioned boxes have margins, they do not collapse with any other
  4842.      margins.
  4843. fixed
  4844.      The box's position is calculated according to the 'absolute' model, but
  4845.      in addition, the box is fixed with respect to some reference. In the
  4846.      case of continuous media, the box is fixed with respect to the viewport
  4847.      (and doesn't move when scrolled). In the case of paged media, the box
  4848.      is fixed with respect to the page, even if that page is seen through a
  4849.      viewport (in the case of a print-preview, for example). Authors may
  4850.      wish to specify 'fixed' in a media-dependent way. For instance, an
  4851.      author may want a box to remain at the top of the viewport on the
  4852.      screen, but not at the top of each printed page. The two specifications
  4853.      may be separated by using an @media rule, as in:
  4854.  
  4855.      Example(s):
  4856.  
  4857.  
  4858.      @media screen {
  4859.        H1#first { position: fixed }
  4860.      }
  4861.      @media print {
  4862.        H1#first { position: static }
  4863.      }
  4864.  
  4865. 9.3.2 Box offsets: 'top', 'right', 'bottom', 'left'
  4866.  
  4867. An element is said to be positioned if its 'position' property has a value
  4868. other than 'static'. Positioned elements generate positioned boxes, laid out
  4869. according to four properties:
  4870.  
  4871. 'top'
  4872.      Value:         <length> | <percentage> | auto | inherit
  4873.      Initial:       auto
  4874.      Applies to:    positioned elements
  4875.      Inherited:     no
  4876.      Percentages:   refer to height of containing block
  4877.      Media:         visual
  4878.  
  4879. This property specifies how far a box's top content edge is offset below the
  4880. top edge of the box's containing block.
  4881.  
  4882. 'right'
  4883.      Value:         <length> | <percentage> | auto | inherit
  4884.      Initial:       auto
  4885.      Applies to:    positioned elements
  4886.      Inherited:     no
  4887.      Percentages:   refer to width of containing block
  4888.      Media:         visual
  4889.  
  4890. This property specifies how far a box's right content edge is offset to the
  4891. left of the right edge of the box's containing block.
  4892.  
  4893. 'bottom'
  4894.      Value:         <length> | <percentage> | auto | inherit
  4895.      Initial:       auto
  4896.      Applies to:    positioned elements
  4897.      Inherited:     no
  4898.      Percentages:   refer to height of containing block
  4899.      Media:         visual
  4900.  
  4901. This property specifies how far a box's bottom content edge is offset above
  4902. the bottom of the box's containing block.
  4903.  
  4904. 'left'
  4905.      Value:         <length> | <percentage> | auto | inherit
  4906.      Initial:       auto
  4907.      Applies to:    positioned elements
  4908.      Inherited:     no
  4909.      Percentages:   refer to width of containing block
  4910.      Media:         visual
  4911.  
  4912. This property specifies how far a box's left content edge is offset to the
  4913. right of the left edge of the box's containing block.
  4914.  
  4915. The values for the four properties have the following meanings:
  4916.  
  4917. <length>
  4918.      The offset is a fixed distance from the reference edge.
  4919. <percentage>
  4920.      The offset is a percentage of the containing block's width (for 'left'
  4921.      or 'right') or height (for 'top' and 'bottom'). For 'top' and 'bottom',
  4922.      if the height of the containing block is not specified explicitly
  4923.      (i.e., it depends on content height), the percentage value is
  4924.      interpreted like 'auto'.
  4925. auto
  4926.      The effect of this value depends on which of related properties have
  4927.      the value 'auto' as well. See the sections on the width and height of
  4928.      absolutely positioned, non-replaced elements for details.
  4929.  
  4930. For absolutely positioned boxes, the offsets are with respect to the box's
  4931. containing block. For relatively positioned boxes, the offsets are with
  4932. respect to the outer edges of the box itself (i.e., the box is given a
  4933. position in the normal flow, then offset from that position according to
  4934. these properties).
  4935.  
  4936. 9.4 Normal flow
  4937.  
  4938. Boxes in the normal flow belong to a formatting context, which may be block
  4939. or inline, but not both simultaneously. Block boxes participate in a block
  4940. formatting context. Inline boxes participate in an inline formatting
  4941. context.
  4942.  
  4943. 9.4.1 Block formatting context
  4944.  
  4945. In a block formatting context, boxes are laid out one after the other,
  4946. vertically, beginning at the top of a containing block. The vertical
  4947. distance between two sibling boxes is determined by the 'margin' properties.
  4948. Vertical margins between adjacent block boxes in a block formatting context
  4949. collapse.
  4950.  
  4951. In a block formatting context, each box's left outer edge touches the left
  4952. edge of the containing block (for right-to-left formatting, right edges
  4953. touch). This is true even in the presence of floats (although a box's
  4954. content area may shrink due to the floats).
  4955.  
  4956. For information about page breaks in paged media, please consult the section
  4957. on allowed page breaks.
  4958.  
  4959. 9.4.2 Inline formatting context
  4960.  
  4961. In an inline formatting context, boxes are laid out horizontally, one after
  4962. the other, beginning at the top of a containing block. Horizontal margins,
  4963. borders, and padding are respected between these boxes. The boxes may be
  4964. aligned vertically in different ways: their bottoms or tops may be aligned,
  4965. or the baselines of text within them may be aligned. The rectangular area
  4966. that contains the boxes that form a line is called a line box.
  4967.  
  4968. The width of a line box is determined by a containing block. The height of a
  4969. line box is determined by the rules given in the section on line height
  4970. calculations. A line box is always tall enough for all of the boxes it
  4971. contains. However, it may be taller than the tallest box it contains (if,
  4972. for example, boxes are aligned so that baselines line up). When the height
  4973. of a box B is less than the height of the line box containing it, the
  4974. vertical alignment of B within the line box is determined by the
  4975. 'vertical-align' property.
  4976.  
  4977. When several inline boxes cannot fit horizontally within a single line box,
  4978. they are distributed among two or more vertically-stacked line boxes. Thus,
  4979. a paragraph is a vertical stack of line boxes. Line boxes are stacked with
  4980. no vertical separation and they never overlap.
  4981.  
  4982. In general, the left edge of a line box touches the left edge of its
  4983. containing block and the right edge touches the right edge of its containing
  4984. block. However, floating boxes may come between the containing block edge
  4985. and the line box edge. Thus, although line boxes in the same inline
  4986. formatting context generally have the same width (that of the containing
  4987. block), they may vary in width if available horizontal space is reduced due
  4988. to floats. Line boxes in the same inline formatting context generally vary
  4989. in height (e.g., one line might contain a tall image while the others
  4990. contain only text).
  4991.  
  4992. When the total width of the inline boxes on a line is less than the width of
  4993. the line box containing them, their horizontal distribution within the line
  4994. box is determined by the 'text-align' property. If that property has the
  4995. value 'justify', the user agent may stretch the inline boxes as well.
  4996.  
  4997. Since an inline box may not exceed the width of a line box, long inline
  4998. boxes are split into several boxes and these boxes distributed across
  4999. several line boxes. When an inline box is split, margins, borders, and
  5000. padding have no visual effect where the split occurs. Formatting of margins,
  5001. borders, and padding may not be fully defined if the split occurs within a
  5002. bidirectional embedding.
  5003.  
  5004. Inline boxes may also be split into several boxes within the same line box
  5005. due to bidirectional text processing.
  5006.  
  5007. Here is an example of inline box construction. The following paragraph
  5008. (created by the HTML block-level element P) contains anonymous text
  5009. interspersed with the elements EM and STRONG:
  5010.  
  5011. <P>Several <EM>emphasized words</EM> appear
  5012. <STRONG>in this</STRONG> sentence, dear.</P>
  5013.  
  5014. The P element generates a block box that contains five inline boxes, three
  5015. of which are anonymous:
  5016.  
  5017.    * Anonymous: "Several"
  5018.    * EM: "emphasized words"
  5019.    * Anonymous: "appear"
  5020.    * STRONG: "in this"
  5021.    * Anonymous: "sentence, dear."
  5022.  
  5023. To format the paragraph, the user agent flows the five boxes into line
  5024. boxes. In this example, the box generated for the P element establishes the
  5025. containing block for the line boxes. If the containing block is sufficiently
  5026. wide, all the inline boxes will fit into a single line box:
  5027.  
  5028.  Several emphasized words appear in this sentence, dear.
  5029.  
  5030. If not, the inline boxes will be split up and distributed across several
  5031. line boxes. The previous paragraph might be split as follows:
  5032.  
  5033. Several emphasized words appear
  5034. in this sentence, dear.
  5035.  
  5036. or like this:
  5037.  
  5038. Several emphasized
  5039. words appear in this
  5040. sentence, dear.
  5041.  
  5042. In the previous example, the EM box was split into two EM boxes (call them
  5043. "split1" and "split2"). Margins, borders, padding, or text decorations have
  5044. no visible effect after split1 or before split2.
  5045.  
  5046. Consider the following example:
  5047.  
  5048. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  5049. <HTML>
  5050.   <HEAD>
  5051.     <TITLE>Example of inline flow on several lines</TITLE>
  5052.     <STYLE type="text/css">
  5053.       EM {
  5054.         padding: 2px;
  5055.         margin: 1em;
  5056.         border-width: medium;
  5057.         border-style: dashed;
  5058.         line-height: 2.4em;
  5059.       }
  5060.     </STYLE>
  5061.   </HEAD>
  5062.   <BODY>
  5063.     <P>Several <EM>emphasized words</EM> appear here.</P>
  5064.   </BODY>
  5065. </HTML>
  5066.  
  5067. Depending on the width of the P, the boxes may be distributed as follows:
  5068.  
  5069. [Image illustrating the effect of line breaking on thedisplay of margins, borders, and padding.]   [D]
  5070.  
  5071.    * The margin is inserted before "emphasized" and after "words".
  5072.    * The padding is inserted before, above, and below "emphasized" and
  5073.      after, above, and below "words". A dashed border is rendered on three
  5074.      sides in each case.
  5075.  
  5076. 9.4.3 Relative positioning
  5077.  
  5078. Once a box has been laid out according to the normal flow, it may be shifted
  5079. relative to this position. This is called relative positioning. Offsetting a
  5080. box (B1) in this way has no effect on the box (B2) that follows: B2 is given
  5081. a position as if B1 were not offset and B2 is not re-positioned after B1's
  5082. offset is applied. This implies that relative positioning may cause boxes to
  5083. overlap.
  5084.  
  5085. Relatively positioned boxes keep their normal flow size, including line
  5086. breaks and the space originally reserved for them. A relatively positioned
  5087. box establishes a new a new containing block for normal flow children and
  5088. positioned descendants.
  5089.  
  5090. A relatively positioned box is generated when the 'position' property for an
  5091. element has the value 'relative'. The offset is specified by the 'top',
  5092. 'bottom', 'left', and 'right' properties.
  5093.  
  5094. Dynamic movement of relatively positioned boxes can produce animation
  5095. effects in scripting environments (see also the 'visibility' property).
  5096. Relative positioning may also be used as a general form of superscripting
  5097. and subscripting except that line height is not automatically adjusted to
  5098. take the positioning into consideration. See the description of line height
  5099. calculations for more information.
  5100.  
  5101. Examples of relative positioning are provided in the section comparing
  5102. normal flow, floats, and absolute positioning.
  5103.  
  5104. 9.5 Floats
  5105.  
  5106. A float is a box that is shifted to the left or right on the current line.
  5107. The most interesting characteristic of a float (or "floated" or "floating"
  5108. box) is that content may flow along its side (or be prohibited from doing so
  5109. by the 'clear' property). Content flows down the right side of a
  5110. left-floated box and down the left side of a right-floated box. The
  5111. following is an introduction to float positioning and content flow; the
  5112. exact rules governing float behavior are given in the description of the
  5113. 'float' property.
  5114.  
  5115. A floated box must have an explicit width (assigned via the 'width'
  5116. property, or its intrinsic width in the case of replaced elements). Any
  5117. floated box becomes a block box that is shifted to the left or right until
  5118. its outer edge touches the containing block edge or the outer edge of
  5119. another float. The top of the floated box is aligned with the top of the
  5120. current line box (or bottom of the preceding block box if no line box
  5121. exists). If there isn't enough horizontal room on the current line for the
  5122. float, it is shifted downward, line by line, until a line has room for it.
  5123.  
  5124. Since a float is not in the flow, non-positioned block boxes created before
  5125. and after the float box flow vertically as if the float didn't exist.
  5126. However, line boxes created next to the float are shortened to make room for
  5127. the floated box. Any content in the current line before a floated box is
  5128. reflowed in the first available line on the other side of the float.
  5129.  
  5130. Several floats may be adjacent, and this model also applies to adjacent
  5131. floats in the same line.
  5132.  
  5133. Example(s):
  5134.  
  5135. The following rule floats all IMG boxes with class="icon" to the left (and
  5136. sets the left margin to '0'):
  5137.  
  5138. IMG.icon {
  5139.   float: left;
  5140.   margin-left: 0;
  5141. }
  5142.  
  5143. Consider the following HTML source and style sheet:
  5144.  
  5145.  
  5146. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  5147. <HTML>
  5148.   <HEAD>
  5149.     <TITLE>Float example</TITLE>
  5150.     <STYLE type="text/css">
  5151.       IMG { float: left }
  5152.       BODY, P, IMG { margin: 2em }
  5153.     </STYLE>
  5154.   </HEAD>
  5155.   <BODY>
  5156.     <P><IMG src=img.gif alt="This image will illustrate floats">
  5157.        Some sample text that has no other...
  5158.   </BODY>
  5159. </HTML>
  5160.  
  5161. The IMG box is floated to the left. The content that follows is formatted to
  5162. the right of the float, starting on the same line as the float. The line
  5163. boxes to the right of the float are shortened due to the float's presence,
  5164. but resume their "normal" width (that of the containing block established by
  5165. the P element) after the float. This document might be formatted as:
  5166.  
  5167. [Image illustrating how floating boxes interact withmargins.]   [D]
  5168.  
  5169. Formatting would have been exactly the same if the document had been:
  5170.  
  5171. <BODY>
  5172.   <P>Some sample text
  5173.   <IMG src=img.gif alt="This image will illustrate floats">
  5174.            that has no other...
  5175. </BODY>
  5176.  
  5177. because the content to the left of the float is displaced by the float and
  5178. reflowed down its right side.
  5179.  
  5180. The margins of floating boxes never collapse with margins of adjacent boxes.
  5181. Thus, in the previous example, vertical margins do not collapse between the
  5182. P box and the floated IMG box.
  5183.  
  5184. A float can overlap other boxes in the normal flow (e.g., when a normal flow
  5185. box next to a float has negative margins). When an inline box overlaps with
  5186. a float, the content, background, and borders of the inline box are rendered
  5187. in front of the float. When a block box overlaps, the background and borders
  5188. of the block box are rendered behind the float and are only be visible where
  5189. the box is transparent. The content of the block box is rendered in front of
  5190. the float.
  5191.  
  5192. Example(s):
  5193.  
  5194. Here is another illustration, showing what happens when a float overlaps
  5195. borders of elements in the normal flow.
  5196.  
  5197. [Image showing a floating imagethat overlaps the borders of two paragraphs: the borders areinterrupted by the image.]   [D]
  5198.  
  5199. A floating image obscures borders of block boxes it overlaps.
  5200.  
  5201. The following example illustrates the use of the 'clear' property to prevent
  5202. content from flowing next to a float.
  5203.  
  5204. Example(s):
  5205.  
  5206. Assuming a rule such as this:
  5207.  
  5208. P { clear: left }
  5209.  
  5210. formatting might look like this:
  5211.  
  5212. [Image showing a floatingimage and the effect of 'clear: left' on the two paragraphs.]   [D]
  5213.  
  5214. Both paragraphs have set 'clear: left', which causes the second paragraph to
  5215. be "pushed down" to a position below the float -- its top margin expands to
  5216. accomplish this (see the 'clear' property).
  5217.  
  5218. 9.5.1 Positioning the float: the 'float' property
  5219.  
  5220. 'float'
  5221.      Value:         left | right | none | inherit
  5222.      Initial:       none
  5223.      Applies to:    all but positioned elements and generated content
  5224.      Inherited:     no
  5225.      Percentages:   N/A
  5226.      Media:         visual
  5227.  
  5228. This property specifies whether a box should float to the left, right, or
  5229. not at all. It may be set for elements that generate boxes that are not
  5230. absolutely positioned. The values of this property have the following
  5231. meanings:
  5232.  
  5233. left
  5234.      The element generates a block box that is floated to the left. Content
  5235.      flows on the right side of the box, starting at the top (subject to the
  5236.      'clear' property). The 'display' is ignored, unless it has the value
  5237.      'none'.
  5238. right
  5239.      Same as 'left', but content flows on the left side of the box, starting
  5240.      at the top.
  5241. none
  5242.      The box is not floated.
  5243.  
  5244. Here are the precise rules that govern the behavior of floats:
  5245.  
  5246.   1. The left outer edge of a left-floating box may not be to the left of
  5247.      the left edge of its containing block. An analogous rule holds for
  5248.      right-floating elements.
  5249.   2. If the current box is left-floating, and there are any left floating
  5250.      boxes generated by elements earlier in the source document, then for
  5251.      each such earlier box, either the left outer edge of the current box
  5252.      must be to the right of the right outer edge of the earlier box, or its
  5253.      top must be lower than the bottom of the earlier box. Analogous rules
  5254.      hold for right-floating boxes.
  5255.   3. The right outer edge of a left-floating box may not be to the right of
  5256.      the left outer edge of any right-floating box that is to the right of
  5257.      it. Analogous rules hold for right-floating elements.
  5258.   4. A floating box's outer top may not be higher than the top of its
  5259.      containing block.
  5260.   5. The outer top of a floating box may not be higher than the outer top of
  5261.      any block or floated box generated by an element earlier in the source
  5262.      document.
  5263.   6. The outer top of an element's floating box may not be higher than the
  5264.      top of any line-box containing a box generated by an element earlier in
  5265.      the source document.
  5266.   7. A left-floating box that has another left-floating box to its left may
  5267.      not have its right outer edge to the right of its containing block's
  5268.      right edge. (Loosely: a left float may not stick out at the right edge,
  5269.      unless it is already as far to the left as possible.) An analogous rule
  5270.      holds for right-floating elements.
  5271.   8. A floating box must be placed as high as possible.
  5272.   9. A left-floating box must be put as far to the left as possible, a
  5273.      right-floating box as far to the right as possible. A higher position
  5274.      is preferred over one that is further to the left/right.
  5275.  
  5276. 9.5.2 Controlling flow next to floats: the 'clear' property
  5277.  
  5278. 'clear'
  5279.      Value:         none | left | right | both | inherit
  5280.      Initial:       none
  5281.      Applies to:    block-level elements
  5282.      Inherited:     no
  5283.      Percentages:   N/A
  5284.      Media:         visual
  5285.  
  5286. This property indicates which sides of an element's box(es) may not be
  5287. adjacent to an earlier floating box. (It may be that the element itself has
  5288. floating descendants; the 'clear' property has no effect on those.)
  5289.  
  5290. This property may only be specified for block-level elements (including
  5291. floats). For compact and run-in boxes, this property applies to the final
  5292. block box to which the compact or run-in box belongs.
  5293.  
  5294. Values have the following meanings when applied to non-floating block boxes:
  5295.  
  5296. left
  5297.      The top margin of the generated box is increased enough that the top
  5298.      border edge is below the bottom outer edge of any left-floating boxes
  5299.      that resulted from elements earlier in the source document.
  5300. right
  5301.      The top margin of the generated box is increased enough that the top
  5302.      border edge is below the bottom outer edge of any right-floating boxes
  5303.      that resulted from elements earlier in the source document.
  5304. both
  5305.      The generated box is moved below all floating boxes of earlier elements
  5306.      in the source document..
  5307. none
  5308.      No constraint on the box's position with respect to floats.
  5309.  
  5310. When the property is set on floating elements, it results in a modification
  5311. of the rules for positioning the float. An extra constraint (#10) is added:
  5312.  
  5313.    * The top outer edge of the float must be below the bottom outer edge of
  5314.      all earlier left-floating boxes (in the case of 'clear: left'), or all
  5315.      earlier right-floating boxes (in the case of 'clear: right'), or both
  5316.      ('clear: both').
  5317.  
  5318. 9.6 Absolute positioning
  5319.  
  5320. In the absolute positioning model, a box is explicitly offset with respect
  5321. to its containing block. It is removed from the normal flow entirely (it has
  5322. no impact on later siblings). An absolutely positioned box establishes a new
  5323. containing block for normal flow children and positioned descendants.
  5324. However, the contents of an absolutely positioned element do not flow around
  5325. any other boxes. They may or may not obscure the contents of another box,
  5326. depending on the stack levels of the overlapping boxes.
  5327.  
  5328. References in this specification to an absolutely positioned element (or its
  5329. box) imply that the element's 'position' property has the value 'absolute'
  5330. or 'fixed'.
  5331.  
  5332. 9.6.1 Fixed positioning
  5333.  
  5334. Fixed positioning is a subcategory of absolute positioning. The only
  5335. difference is that for a fixed positioned box, the containing block is
  5336. established by the viewport. For continuous media, fixed boxes do not move
  5337. when the document is scrolled. In this respect, they are similar to fixed
  5338. background images. For paged media, boxes with fixed positions are repeated
  5339. on every page. This is useful for placing, for instance, a signature at the
  5340. bottom of each page.
  5341.  
  5342. Authors may use fixed positioning to create frame-like presentations.
  5343. Consider the following frame layout:
  5344.  
  5345. [Image illustrating a frame-like layout with position='fixed'.]   [D]
  5346.  
  5347. This might be achieved with the following HTML document and style rules:
  5348.  
  5349. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  5350. <HTML>
  5351.   <HEAD>
  5352.     <TITLE>A frame document with CSS2</TITLE>
  5353.     <STYLE type="text/css">
  5354.       BODY { height: 8.5in } /* Required for percentage heights below */
  5355.       #header {
  5356.         position: fixed;
  5357.         width: 100%;
  5358.         height: 15%;
  5359.         top: 0;
  5360.         right: 0;
  5361.         bottom: auto;
  5362.         left: 0;
  5363.       }
  5364.       #sidebar {
  5365.         position: fixed;
  5366.         width: 10em;
  5367.         height: auto;
  5368.         top: 15%;
  5369.         right: auto;
  5370.         bottom: 100px;
  5371.         left: 0;
  5372.       }
  5373.       #main {
  5374.         position: fixed;
  5375.         width: auto;
  5376.         height: auto;
  5377.         top: 15%;
  5378.         right: 0;
  5379.         bottom: 100px;
  5380.         left: 10em;
  5381.       }
  5382.       #footer {
  5383.         position: fixed;
  5384.         width: 100%;
  5385.         height: 100px;
  5386.         top: auto;
  5387.         right: 0;
  5388.         bottom: 0;
  5389.         left: 0;
  5390.       }
  5391.     </STYLE>
  5392.   </HEAD>
  5393.   <BODY>
  5394.     <DIV id="header"> ...  </DIV>
  5395.     <DIV id="sidebar"> ...  </DIV>
  5396.     <DIV id="main"> ...  </DIV>
  5397.     <DIV id="footer"> ...  </DIV>
  5398.   </BODY>
  5399. </HTML>
  5400.  
  5401. 9.7 Relationships between 'display', 'position', and 'float'
  5402.  
  5403. The three properties that affect box generation and layout -- 'display',
  5404. 'position', and 'float' -- interact as follows:
  5405.  
  5406.   1. If 'display' has the value 'none', user agents must ignore 'position'
  5407.      and 'float'. In this case, the element generates no box.
  5408.   2. Otherwise, 'position' has the value 'absolute' or 'fixed', 'display' is
  5409.      set to 'block' and 'float' is set to 'none'. The position of the box
  5410.      will be determined by the 'top', 'right', 'bottom' and 'left'
  5411.      properties and the box's containing block.
  5412.   3. Otherwise, if 'float' has a value other than 'none', 'display' is set
  5413.      to 'block' and the box is floated.
  5414.   4. Otherwise, the remaining 'display' properties apply as specified.
  5415.  
  5416. Note. CSS2 does not specify layout behavior when values for these properties
  5417. are changed by scripts. For example, what happens when an element having
  5418. 'width: auto' is repositioned? Do the contents reflow, or do they maintain
  5419. their original formatting? The answer is outside the scope of this document,
  5420. and such behavior is likely to differ in initial implementations of CSS2.
  5421.  
  5422. 9.8 Comparison of normal flow, floats, and absolute positioning
  5423.  
  5424. To illustrate the differences between normal flow, relative positioning,
  5425. floats, and absolute positioning, we provide a series of examples based on
  5426. the following HTML fragment:
  5427.  
  5428. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  5429. <HTML>
  5430.   <HEAD>
  5431.     <TITLE>Comparison of positioning schemes</TITLE>
  5432.   </HEAD>
  5433.   <BODY>
  5434.     <P>Beginning of body contents.
  5435.       <SPAN id="outer"> Start of outer contents.
  5436.       <SPAN id="inner"> Inner contents.</SPAN>
  5437.       End of outer contents.</SPAN>
  5438.       End of body contents.
  5439.     </P>
  5440.   </BODY>
  5441. </HTML>
  5442.  
  5443. In this document, we assume the following rules:
  5444.  
  5445. BODY { display: block; line-height: 200%;
  5446.        width: 400px; height: 400px }
  5447. P    { display: block }
  5448. SPAN { display: inline }
  5449.  
  5450. The final positions of boxes generated by the outer and inner elements vary
  5451. in each example. In each illustration, the numbers to the left of the
  5452. illustration indicate the normal flow position of the double-spaced (for
  5453. clarity) lines. (Note: the illustrations use different horizontal and
  5454. vertical scales.)
  5455.  
  5456. 9.8.1 Normal flow
  5457.  
  5458. Consider the following CSS declarations for outer and inner that don't alter
  5459. the normal flow of boxes:
  5460.  
  5461. #outer { color: red }
  5462. #inner { color: blue }
  5463.  
  5464. The P element contains all inline content: anonymous inline text and two
  5465. SPAN element. Therefore, all of the content will be laid out in an inline
  5466. formatting context, within a containing block established by the P element,
  5467. producing something like:
  5468.  
  5469. [Image illustrating the normal flow of text between parent and sibling boxes.]   [D]
  5470.  
  5471. 9.8.2 Relative positioning
  5472.  
  5473. To see the effect of relative positioning, we specify:
  5474.  
  5475. #outer { position: relative; top: -12px; color: red }
  5476. #inner { position: relative; top: 12px; color: blue }
  5477.  
  5478. Text flows normally up to the outer element. The outer text is then flowed
  5479. into its normal flow position and dimensions at the end of line 1. Then, the
  5480. inline boxes containing the text (distributed over three lines) are shifted
  5481. as a unit by '-12px' (upwards).
  5482.  
  5483. The contents of inner, as a child of outer, would normally flow immediately
  5484. after the words "of outer contents" (on line 1.5). However, the inner
  5485. contents are themselves offset relative to the outer contents by '12px'
  5486. (downwards), back to their original position on line 2.
  5487.  
  5488. Note that the content following outer is not affected by the relative
  5489. positioning of outer.
  5490.  
  5491. [Image illustrating the effects of relative positioning on abox's content.]   [D]
  5492.  
  5493. Note also that had the offset of outer been '-24px', the text of outer and
  5494. the body text would have overlapped.
  5495.  
  5496. 9.8.3 Floating a box
  5497.  
  5498. Now consider the effect of floating the inner element's text to the right by
  5499. means of the following rules:
  5500.  
  5501. #outer { color: red }
  5502. #inner { float: right; width: 130px; color: blue }
  5503.  
  5504. Text flows normally up to the inner box, which is pulled out of the flow and
  5505. floated to the right margin (its 'width' has been assigned explicitly). Line
  5506. boxes to the left of the float are shortened, and the document's remaining
  5507. text flows into them.
  5508.  
  5509. [Image illustrating the effects of floating a box.]   [D]
  5510.  
  5511. To show the effect of the 'clear' property, we add a sibling element to the
  5512. example:
  5513.  
  5514. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  5515. <HTML>
  5516.   <HEAD>
  5517.     <TITLE>Comparison of positioning schemes II</TITLE>
  5518.   </HEAD>
  5519.   <BODY>
  5520.     <P>Beginning of body contents.
  5521.       <SPAN id=outer> Start of outer contents.
  5522.       <SPAN id=inner> Inner contents.</SPAN>
  5523.       <SPAN id=sibling> Sibling contents.</SPAN>
  5524.       End of outer contents.</SPAN>
  5525.       End of body contents.
  5526.     </P>
  5527.   </BODY>
  5528. </HTML>
  5529.  
  5530. The following rules:
  5531.  
  5532. #inner { float: right; width: 130px; color: blue }
  5533. #sibling { color: red }
  5534.  
  5535. cause the inner box to float to the right as before and the document's
  5536. remaining text to flow into the vacated space:
  5537.  
  5538. [Image illustrating the effects of floating a box withoutsetting the clear property to control the flow of text around thebox.]   [D]
  5539.  
  5540. However, if the 'clear' property on the sibling element is set to 'right'
  5541. (i.e., the generated sibling box will not accept a position next to floating
  5542. boxes to its right), the sibling content begins to flow below the float:
  5543.  
  5544. #inner { float: right; width: 130px; color: blue }
  5545. #sibling { clear: right; color: red }
  5546.  
  5547. [Image illustrating the effects of floating an element with setting the clear property to control the flow of text around the element.]   [D]
  5548.  
  5549. 9.8.4 Absolute positioning
  5550.  
  5551. Finally, we consider the effect of absolute positioning. Consider the
  5552. following CSS declarations for outer and inner:
  5553.  
  5554. #outer {
  5555.     position: absolute;
  5556.     top: 200px; left: 200px;
  5557.     width: 200px;
  5558.     color: red;
  5559. }
  5560. #inner { color: blue }
  5561.  
  5562. which cause the top of the outer box to be positioned with respect to its
  5563. containing block. The containing block for a positioned box is established
  5564. by the nearest positioned ancestor (or, if none exists, the initial
  5565. containing block, as in our example). The top side of the outer box is
  5566. '200px' below the top of the containing block and the left side is '200px'
  5567. from the left side. The child box of outer is flowed normally with respect
  5568. to its parent.
  5569.  
  5570. [Image illustrating the effects of absolutely positioning a box.]   [D]
  5571.  
  5572. The following example shows an absolutely positioned box that is a child of
  5573. a relatively positioned box. Although the parent outer box is not actually
  5574. offset, setting its 'position' property to 'relative' means that its box may
  5575. serve as the containing block for positioned descendants. Since the outer
  5576. box is an inline box that is split across several lines, the first inline
  5577. box's top and left edges (depicted by thick dashed lines in the illustration
  5578. below) serve as references for 'top' and 'left' offsets.
  5579.  
  5580. #outer {
  5581.   position: relative;
  5582.   color: red
  5583. }
  5584. #inner {
  5585.   position: absolute;
  5586.   top: 200px; left: -100px;
  5587.   height: 130px; width: 130px;
  5588.   color: blue;
  5589. }
  5590.  
  5591. This results in something like the following:
  5592.  
  5593. [Image illustrating the effects of absolutely positioning abox with respect to a containing block.]   [D]
  5594.  
  5595. If we do not position the outer box:
  5596.  
  5597. #outer { color: red }
  5598. #inner {
  5599.   position: absolute;
  5600.   top: 200px; left: -100px;
  5601.   height: 130px; width: 130px;
  5602.   color: blue;
  5603. }
  5604.  
  5605. the containing block for inner becomes the initial containing block (in our
  5606. example). The following illustration shows where the inner box would end up
  5607. in this case.
  5608.  
  5609. [Image illustrating the effects of absolutely positioning a box with respect to a containing block established by a normally positioned parent.]   [D]
  5610.  
  5611. Relative and absolute positioning may be used to implement change bars, as
  5612. shown in the following example. The following document:
  5613.  
  5614. <P style="position: relative; margin-right: 10px; left: 10px;">
  5615. I used two red hyphens to serve as a change bar. They
  5616. will "float" to the left of the line containing THIS
  5617. <SPAN style="position: absolute; top: auto; left: -1em; color: red;">--</SPAN>
  5618. word.</P>
  5619.  
  5620. might result in something like:
  5621.  
  5622. [Image illustrating the use of floats to create a changebar effect.]   [D]
  5623.  
  5624. First, the paragraph (whose containing block sides are shown in the
  5625. illustration) is flowed normally. Then it is offset '10px' from the left
  5626. edge of the containing block (thus, a right margin of '10px' has been
  5627. reserved in anticipation of the offset). The two hyphens acting as change
  5628. bars are taken out of the flow and positioned at the current line (due to
  5629. 'top: auto'), '-1em' from the left edge of its containing block (established
  5630. by the P in its final position). The result is that the change bars seem to
  5631. "float" to the left of the current line.
  5632.  
  5633. 9.9 Layered presentation
  5634.  
  5635. In the following sections, the expression "in front of" means closer to the
  5636. user as the user faces the screen.
  5637.  
  5638. In CSS2, each box has a position in three dimensions. In addition to their
  5639. horizontal and vertical positions, boxes lie along a "z-axis" and are
  5640. formatted one on top of the other. Z-axis positions are particularly
  5641. relevant when boxes overlap visually. This section discusses how boxes may
  5642. be positioned along the z-axis.
  5643.  
  5644. Each box belongs to one stacking context. Each box in a given stacking
  5645. context has an integer stack level, which is its position on the z-axis
  5646. relative to other boxes in the same stacking context. Boxes with greater
  5647. stack levels are always formatted in front of boxes with lower stack levels.
  5648. Boxes may have negative stack levels. Boxes with the same stack level in a
  5649. stacking context are stacked bottom-to-top according to document tree order.
  5650.  
  5651. The root element creates a root stacking context, but other elements may
  5652. establish local stacking contexts. Stacking contexts are inherited. A local
  5653. stacking context is atomic; boxes in other stacking contexts may not come
  5654. between any of its boxes.
  5655.  
  5656. An element that establishes a local stacking context generates a box that
  5657. has two stack levels: one for the stacking context it creates (always '0')
  5658. and one for the stacking context to which it belongs (given by the 'z-index'
  5659. property).
  5660.  
  5661. An element's box has the same stack level as its parent's box unless given a
  5662. different stack level with the 'z-index' property.
  5663.  
  5664. 9.9.1 Specifying the stack level: the 'z-index' property
  5665.  
  5666. 'z-index'
  5667.      Value:         auto | <integer> | inherit
  5668.      Initial:       auto
  5669.      Applies to:    positioned elements
  5670.      Inherited:     no
  5671.      Percentages:   N/A
  5672.      Media:         visual
  5673.  
  5674. For a positioned box, the 'z-index' property specifies:
  5675.  
  5676.   1. The stack level of the box in the current stacking context.
  5677.   2. Whether the box establishes a local stacking context.
  5678.  
  5679. Values have the following meanings:
  5680.  
  5681. <integer>
  5682.      This integer is the stack level of the generated box in the current
  5683.      stacking context. The box also establishes a local stacking context in
  5684.      which its stack level is '0'.
  5685. auto
  5686.      The stack level of the generated box in the current stacking context is
  5687.      the same as its parent's box. The box does not establish a new local
  5688.      stacking context.
  5689.  
  5690. In the following example, the stack levels of the boxes (named with their
  5691. "id" attributes) are: "text2"=0, "image"=1, "text3"=2, and "text1"=3. The
  5692. "text2" stack level is inherited from the root box. The others are specified
  5693. with the 'z-index' property.
  5694.  
  5695. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  5696. <HTML>
  5697.   <HEAD>
  5698.     <TITLE>Z-order positioning</TITLE>
  5699.     <STYLE type="text/css">
  5700.       .pile {
  5701.         position: absolute;
  5702.         left: 2in;
  5703.         top: 2in;
  5704.         width: 3in;
  5705.         height: 3in;
  5706.       }
  5707.     </STYLE>
  5708.   </HEAD>
  5709.   <BODY>
  5710.     <P>
  5711.       <IMG id="image" class="pile"
  5712.            src="butterfly.gif" alt="A butterfly image"
  5713.            style="z-index: 1">
  5714.  
  5715.     <DIV id="text1" class="pile"
  5716.          style="z-index: 3">
  5717.       This text will overlay the butterfly image.
  5718.     </DIV>
  5719.  
  5720.     <DIV id="text2">
  5721.       This text will be beneath everything.
  5722.     </DIV>
  5723.  
  5724.     <DIV id="text3" class="pile"
  5725.          style="z-index: 2">
  5726.       This text will underlay text1, but overlay the butterfly image
  5727.     </DIV>
  5728.   </BODY>
  5729. </HTML>
  5730.  
  5731. This example demonstrates the notion of transparency. The default behavior
  5732. of a box is to allow boxes behind it to be visible through transparent areas
  5733. in its content. In the example, each box transparently overlays the boxes
  5734. below it. This behavior can be overridden by using one of the existing
  5735. background properties.
  5736.  
  5737. 9.10 Text direction: the 'direction' and 'unicode-bidi' properties
  5738.  
  5739. The characters in certain scripts are written from right to left. In some
  5740. documents, in particular those written with the Arabic or Hebrew script, and
  5741. in some mixed-language contexts, text in a single (visually displayed) block
  5742. may appear with mixed directionality. This phenomenon is called
  5743. bidirectionality, or "bidi" for short.
  5744.  
  5745. The Unicode standard ([UNICODE], section 3.11) defines a complex algorithm
  5746. for determining the proper directionality of text. The algorithm consists of
  5747. an implicit part based on character properties, as well as explicit controls
  5748. for embeddings and overrides. CSS2 relies on this algorithm to achieve
  5749. proper bidirectional rendering. The 'direction' and 'unicode-bidi'
  5750. properties allow authors to specify how the elements and attributes of a
  5751. document language map to this algorithm.
  5752.  
  5753. If a document contains right-to-left characters, and if the user agent
  5754. displays these characters (with appropriate glyphs, not arbitrary
  5755. substitutes such as a question mark, a hex code, a black box, etc.), the
  5756. user agent must apply the bidirectional algorithm. This seemingly one-sided
  5757. requirement reflects the fact that, although not every Hebrew or Arabic
  5758. document contains mixed-directionality text, such documents are much more
  5759. likely to contain left-to-right text (e.g., numbers, text from other
  5760. languages) than are documents written in left-to-right languages.
  5761.  
  5762. Because the directionality of a text depends on the structure and semantics
  5763. of the document language, these properties should in most cases be used only
  5764. by designers of document type descriptions (DTDs), or authors of special
  5765. documents. If a default style sheet specifies these properties, authors and
  5766. users should not specify rules to override them. A typical exception would
  5767. be to override bidi behavior in a user agent if that user agent
  5768. transliterates Yiddish (usually written with Hebrew letters) to Latin
  5769. letters at the user's request.
  5770.  
  5771. The HTML 4.0 specification ([HTML40], section 8.2) defines bidirectionality
  5772. behavior for HTML elements. Conforming HTML user agents may therefore ignore
  5773. the 'direction' and 'unicode-bidi' properties in author and user style
  5774. sheets. The style sheet rules that would achieve the bidi behavior specified
  5775. in [HTML40] are given in the sample style sheet. The HTML 4.0 specification
  5776. also contains more information on bidirectionality issues.
  5777.  
  5778. 'direction'
  5779.      Value:         ltr | rtl | inherit
  5780.      Initial:       ltr
  5781.      Applies to:    all elements, but see prose
  5782.      Inherited:     yes
  5783.      Percentages:   N/A
  5784.      Media:         visual
  5785.  
  5786. This property specifies the base writing direction of blocks and the
  5787. direction of embeddings and overrides (see 'unicode-bidi') for the Unicode
  5788. bidirectional algorithm. In addition, it specifies the direction of table
  5789. column layout, the direction of horizontal overflow, and the position of an
  5790. incomplete last line in a block in case of 'text-align: justify'.
  5791.  
  5792. Values for this property have the following meanings:
  5793.  
  5794. ltr
  5795.      Left-to-right direction.
  5796. rtl
  5797.      Right-to-left direction.
  5798.  
  5799. For the 'direction' property to have any effect on inline-level elements,
  5800. the 'unicode-bidi' property's value must be 'embed' or 'override'.
  5801.  
  5802. Note. The 'direction' property, when specified for table column elements, is
  5803. not inherited by cells in the column since columns don't exist in the
  5804. document tree. Thus, CSS cannot easily capture the "dir" attribute
  5805. inheritance rules described in [HTML40], section 11.3.2.1.
  5806.  
  5807. 'unicode-bidi'
  5808.      Value:         normal | embed | bidi-override | inherit
  5809.      Initial:       normal
  5810.      Applies to:    all elements, but see prose
  5811.      Inherited:     no
  5812.      Percentages:   N/A
  5813.      Media:         visual
  5814.  
  5815. Values for this property have the following meanings:
  5816.  
  5817. normal
  5818.      The element does not open an additional level of embedding with respect
  5819.      to the bidirectional algorithm. For inline-level elements, implicit
  5820.      reordering works across element boundaries.
  5821. embed
  5822.      If the element is inline-level, this value opens an additional level of
  5823.      embedding with respect to the bidirectional algorithm. The direction of
  5824.      this embedding level is given by the 'direction' property. Inside the
  5825.      element, reordering is done implicitly. This corresponds to adding a
  5826.      LRE (U+202A; for 'direction: ltr') or RLE (U+202B; for 'direction:
  5827.      rtl') at the start of the element and a PDF (U+202C) at the end of the
  5828.      element.
  5829. bidi-override
  5830.      If the element is inline-level or a block-level element that contains
  5831.      only inline-level elements, this creates an override. This means that
  5832.      inside the element, reordering is strictly in sequence according to the
  5833.      'direction' property; the implicit part of the bidirectional algorithm
  5834.      is ignored. This corresponds to adding a LRO (U+202D; for 'direction:
  5835.      ltr') or RLO (U+202E; for 'direction: rtl') at the start of the element
  5836.      and a PDF (U+202C) at the end of the element.
  5837.  
  5838. The final order of characters in each block-level element is the same as if
  5839. the bidi control codes had been added as described above, markup had been
  5840. stripped, and the resulting character sequence had been passed to an
  5841. implementation of the Unicode bidirectional algorithm for plain text that
  5842. produced the same line-breaks as the styled text. In this process,
  5843. non-textual entities such as images are treated as neutral characters,
  5844. unless their 'unicode-bidi' property has a value other than 'normal', in
  5845. which case they are treated as strong characters in the 'direction'
  5846. specified for the element.
  5847.  
  5848. Please note that in order to be able to flow inline boxes in a uniform
  5849. direction (either entirely left-to-right or entirely right-to-left), more
  5850. inline boxes (including anonymous inline boxes) may have to be created, and
  5851. some inline boxes may have to be split up and reordered before flowing.
  5852.  
  5853. Because the Unicode algorithm has a limit of 15 levels of embedding, care
  5854. should be taken not to use 'unicode-bidi' with a value other than 'normal'
  5855. unless appropriate. In particular, a value of 'inherit' should be used with
  5856. extreme caution. However, for elements that are, in general, intended to be
  5857. displayed as blocks, a setting of 'unicode-bidi: embed' is preferred to keep
  5858. the element together in case display is changed to inline (see example
  5859. below).
  5860.  
  5861. The following example shows an XML document with bidirectional text. It
  5862. illustrates an important design principle: DTD designers should take bidi
  5863. into account both in the language proper (elements and attributes) and in
  5864. any accompanying style sheets. The style sheets should be designed so that
  5865. bidi rules are separate from other style rules. The bidi rules should not be
  5866. overridden by other style sheets so that the document language's or DTD's
  5867. bidi behavior is preserved.
  5868.  
  5869. Example(s):
  5870.  
  5871. In this example, lowercase letters stand for inherently left-to-right
  5872. characters and uppercase letters represent inherently right-to-left
  5873. characters:
  5874.  
  5875. <HEBREW>
  5876.   <PAR>HEBREW1 HEBREW2 english3 HEBREW4 HEBREW5</PAR>
  5877.   <PAR>HEBREW6 <EMPH>HEBREW7</EMPH> HEBREW8</PAR>
  5878. </HEBREW>
  5879. <ENGLISH>
  5880.   <PAR>english9 english10 english11 HEBREW12 HEBREW13</PAR>
  5881.   <PAR>english14 english15 english16</PAR>
  5882.   <PAR>english17 <HE-QUO>HEBREW18 english19 HEBREW20</HE-QUO></PAR>
  5883. </ENGLISH>
  5884.  
  5885. Since this is XML, the style sheet is responsible for setting the writing
  5886. direction. This is the style sheet:
  5887.  
  5888. /* Rules for bidi */
  5889. HEBREW, HE-QUO  {direction: rtl; unicode-bidi: embed}
  5890. ENGLISH         {direction: ltr; unicode-bidi: embed}
  5891.  
  5892. /* Rules for presentation */
  5893. HEBREW, ENGLISH, PAR  {display: block}
  5894. EMPH                  {font-weight: bold}
  5895.  
  5896. The HEBREW element is a block with a right-to-left base direction, the
  5897. ENGLISH element is a block with a left-to-right base direction. The PARs are
  5898. blocks that inherit the base direction from their parents. Thus, the first
  5899. two PARs are read starting at the top right, the final three are read
  5900. starting at the top left. Please note that HEBREW and ENGLISH are chosen as
  5901. element names for explicitness only; in general, element names should convey
  5902. structure without reference to language.
  5903.  
  5904. The EMPH element is inline-level, and since its value for 'unicode-bidi' is
  5905. 'normal' (the initial value), it has no effect on the ordering of the text.
  5906. The HE-QUO element, on the other hand, creates an embedding.
  5907.  
  5908. The formatting of this text might look like this if the line length is long:
  5909.  
  5910.                5WERBEH 4WERBEH english3 2WERBEH 1WERBEH
  5911.  
  5912.                                 8WERBEH 7WERBEH 6WERBEH
  5913.  
  5914. english9 english10 english11 13WERBEH 12WERBEH
  5915.  
  5916. english14 english15 english16
  5917.  
  5918. english17 20WERBEH english19 18WERBEH
  5919.  
  5920. Note that the HE-QUO embedding causes HEBREW18 to be to the right of
  5921. english19.
  5922.  
  5923. If lines have to be broken, it might be more like this:
  5924.  
  5925.        2WERBEH 1WERBEH
  5926.   -EH 4WERBEH english3
  5927.                  5WERB
  5928.  
  5929.    -EH 7WERBEH 6WERBEH
  5930.                  8WERB
  5931.  
  5932. english9 english10 en-
  5933. glish11 12WERBEH
  5934. 13WERBEH
  5935.  
  5936. english14 english15
  5937. english16
  5938.  
  5939. english17 18WERBEH
  5940. 20WERBEH english19
  5941.  
  5942. Because HEBREW18 must be read before english19, it is on the line above
  5943. english19. Just breaking the long line from the earlier formatting would not
  5944. have worked. Note also that the first syllable from english19 might have fit
  5945. on the previous line, but hyphenation of left-to-right words in a
  5946. right-to-left context, and vice versa, is usually suppressed to avoid having
  5947. to display a hyphen in the middle of a line.
  5948.   ------------------------------------------------------------------------
  5949.   ------------------------------------------------------------------------
  5950.  
  5951.                      10 Visual formatting model details
  5952.  
  5953. Contents
  5954.  
  5955.    * 10.1 Definition of "containing block"
  5956.    * 10.2 Content width: the 'width' property
  5957.    * 10.3 Computing widths and margins
  5958.         o 10.3.1 Inline, non-replaced elements
  5959.         o 10.3.2 Inline, replaced elements
  5960.         o 10.3.3 Block-level, non-replaced elements in normal flow
  5961.         o 10.3.4 Block-level, replaced elements in normal flow
  5962.         o 10.3.5 Floating, non-replaced elements
  5963.         o 10.3.6 Floating, replaced elements
  5964.         o 10.3.7 Absolutely positioned, non-replaced elements
  5965.         o 10.3.8 Absolutely positioned, replaced elements
  5966.    * 10.4 Minimum and maximum widths: 'min-width' and 'max-width'
  5967.    * 10.5 Content height: the 'height' property
  5968.    * 10.6 Computing heights and margins
  5969.         o 10.6.1 Inline, non-replaced elements
  5970.         o 10.6.2 Inline, replaced elements block-level, replaced elements in
  5971.           normal flow, and floating, replaced elements
  5972.         o 10.6.3 Block-level, non-replaced elements in normal flow, and
  5973.           floating, non-replaced elements
  5974.         o 10.6.4 Absolutely positioned, non-replaced elements
  5975.         o 10.6.5 Absolutely positioned, replaced elements
  5976.    * 10.7 Minimum and maximum heights: 'min-height' and 'max-height'
  5977.    * 10.8 Line height calculations: the 'line-height' and 'vertical-align'
  5978.      properties
  5979.         o 10.8.1 Leading and half-leading
  5980.  
  5981. 10.1 Definition of "containing block"
  5982.  
  5983. The position and size of an element's box(es) are sometimes computed
  5984. relative to a certain rectangle, called the containing block of the element.
  5985. The containing block of an element is defined as follows:
  5986.  
  5987.   1. The containing block (called the initial containing block) in which the
  5988.      root element lives is chosen by the user agent.
  5989.   2. For other elements, unless the element is absolutely positioned, the
  5990.      containing block is formed by the content edge of the nearest
  5991.      block-level ancestor box.
  5992.   3. If the element has 'position: fixed', the containing block is
  5993.      established by the viewport.
  5994.   4. If the element has 'position: absolute', the containing block is
  5995.      established by the nearest ancestor with a 'position' other than
  5996.      'static', in the following way:
  5997.        1. In the case that the ancestor is block-level, the containing block
  5998.           is formed by the padding edge of the ancestor.
  5999.        2. In the case that the ancestor is inline-level, the containing
  6000.           block depends on the 'direction' property of the ancestor:
  6001.             1. If the 'direction' is 'ltr', the top and left of the
  6002.                containing block are the top and left content edges of the
  6003.                first box generated by the ancestor, and the bottom and right
  6004.                are the bottom and right content edges of the last box of the
  6005.                ancestor.
  6006.             2. If the 'direction' is 'rtl', the top and right are the top
  6007.                and right edges of the first box generated by the ancestor,
  6008.                and the bottom and left are the bottom and left content edges
  6009.                of the last box of the ancestor.
  6010.  
  6011.      If there is no such ancestor, the content edge of the root element's
  6012.      box establishes the containing block.
  6013.  
  6014. Example(s):
  6015.  
  6016. With no positioning, the containing blocks (C.B.) in the following document:
  6017.  
  6018. <HTML>
  6019.    <HEAD>
  6020.       <TITLE>Illustration of containing blocks</TITLE>
  6021.    </HEAD>
  6022.    <BODY id="body">
  6023.       <DIV id="div1">
  6024.       <P id="p1">This is text in the first paragraph...</P>
  6025.       <P id="p2">This is text <EM id="em1"> in the
  6026.       <STRONG id="strong1">second</STRONG> paragraph.</EM></P>
  6027.       </DIV>
  6028.    </BODY>
  6029. </HTML>
  6030.  
  6031. are established as follows:
  6032.  
  6033.  For box generated by    C.B. is established by
  6034.          body         initial C.B. (UA-dependent)
  6035.          div1                     body
  6036.           p1                      div1
  6037.           p2                      div1
  6038.           em1                      p2
  6039.         strong1                    p2
  6040.  
  6041. If we position "div1":
  6042.  
  6043.    #div1 { position: absolute; left: 50px; top: 50px }
  6044.  
  6045. its containing block is no longer "body"; it becomes the initial containing
  6046. block (since there are no other positioned ancestor boxes).
  6047.  
  6048. If we position "em1" as well:
  6049.  
  6050.    #div1 { position: absolute; left: 50px; top: 50px }
  6051.    #em1  { position: absolute; left: 100px; top: 100px }
  6052.  
  6053. the table of containing blocks becomes:
  6054.  
  6055.  For box generated by C.B. is established by
  6056.          body              initial C.B.
  6057.          div1              initial C.B.
  6058.           p1                   div1
  6059.           p2                   div1
  6060.           em1                  div1
  6061.         strong1                 em1
  6062.  
  6063. By positioning "em1", its containing block becomes the nearest positioned
  6064. ancestor box (i.e., that generated by "div1").
  6065.  
  6066. 10.2 Content width: the 'width' property
  6067.  
  6068. 'width'
  6069.      Value:         <length> | <percentage> | auto | inherit
  6070.      Initial:       auto
  6071.      Applies to:    all elements but non-replaced inline elements, table
  6072.                     rows, and row groups
  6073.      Inherited:     no
  6074.      Percentages:   refer to width of containing block
  6075.      Media:         visual
  6076.  
  6077. This property specifies the content width of boxes generated by block-level
  6078. and replaced elements.
  6079.  
  6080. This property does not apply to non-replaced inline-level elements. The
  6081. width of a non-replaced inline element's boxes is that of the rendered
  6082. content within them (before any relative offset of children). Recall that
  6083. inline boxes flow into line boxes. The width of line boxes is given by the
  6084. their containing block, but may be shorted by the presence of floats.
  6085.  
  6086. The width of a replaced element's box is intrinsic and may be scaled by the
  6087. user agent if the value of this property is different than 'auto'.
  6088.  
  6089. Values have the following meanings:
  6090.  
  6091. <length>
  6092.      Specifies a fixed width.
  6093. <percentage>
  6094.      Specifies a percentage width. The percentage is calculated with respect
  6095.      to the width of the generated box's containing block.
  6096. auto
  6097.      The width depends on the values of other properties. See the sections
  6098.      below.
  6099.  
  6100. Negative values for 'width' are illegal.
  6101.  
  6102. Example(s):
  6103.  
  6104. For example, the following rule fixes the content width of paragraphs at 100
  6105. pixels:
  6106.  
  6107. P { width: 100px }
  6108.  
  6109. 10.3 Computing widths and margins
  6110.  
  6111. The computed values of an element's 'width', 'margin-left', 'margin-right',
  6112. 'left' and 'right' properties depend on the type of box generated and on
  6113. each other. In principle, the computed values are the same as the specified
  6114. values, with 'auto' replaced by some suitable value, but there are
  6115. exceptions. The following situations need to be distinguished:
  6116.  
  6117.   1. inline, non-replaced elements
  6118.   2. inline, replaced elements
  6119.   3. block-level, non-replaced elements in normal flow
  6120.   4. block-level, replaced elements in normal flow
  6121.   5. floating, non-replaced elements
  6122.   6. floating, replaced elements
  6123.   7. absolutely positioned, non-replaced elements
  6124.   8. absolutely positioned, replaced elements
  6125.  
  6126. Points 1-6 include relative positioning.
  6127.  
  6128. 10.3.1 Inline, non-replaced elements
  6129.  
  6130. The 'width' property does not apply. A specified value of 'auto' for 'left',
  6131. 'right', 'margin-left' or 'margin-right' becomes a computed value of '0'.
  6132.  
  6133. 10.3.2 Inline, replaced elements
  6134.  
  6135. A specified value of 'auto' for 'left', 'right', 'margin-left' or
  6136. 'margin-right' becomes a computed value of '0'. A specified value of 'auto'
  6137. for 'width' gives the element's intrinsic width as the computed value.
  6138.  
  6139. 10.3.3 Block-level, non-replaced elements in normal flow
  6140.  
  6141. If 'left' or 'right' are given as 'auto', their computed value is 0. The
  6142. following constraints must hold between the other properties:
  6143.  
  6144.      'margin-left' + 'border-left-width' + 'padding-left' + 'width' +
  6145.      'padding-right' + 'border-right-width' + 'margin-right' = width of
  6146.      containing block
  6147.  
  6148. (If the border style is 'none', use '0' as the border width.) If all of the
  6149. above have a specified value other than 'auto', the values are said to be
  6150. "over-constrained" and one of the computed values will have to be different
  6151. from its specified value. If the 'direction' property has the value 'ltr',
  6152. the specified value of 'margin-right' is ignored and the value is computed
  6153. so as to make the equality true. If the value of 'direction' is 'ltr', this
  6154. happens to 'margin-left' instead.
  6155.  
  6156. If there is exactly one value specified as 'auto', its computed value
  6157. follows from the equality.
  6158.  
  6159. If 'width' is set to 'auto', any other 'auto' values become '0' and 'width'
  6160. follows from the resulting equality.
  6161.  
  6162. If both 'margin-left' and 'margin-right' are 'auto', their computed values
  6163. are equal.
  6164.  
  6165. 10.3.4 Block-level, replaced elements in normal flow
  6166.  
  6167. If 'left' or 'right' are 'auto', their computed value is 0. If 'width' is
  6168. specified as 'auto', its value is the element's intrinsic width. If one of
  6169. the margins is 'auto', its computed value is given by the constraints above.
  6170. Furthermore, if both margins are 'auto', their computed values are equal.
  6171.  
  6172. 10.3.5 Floating, non-replaced elements
  6173.  
  6174. If 'left', 'right', 'width', 'margin-left', or 'margin-right' are specified
  6175. as 'auto', their computed value is '0'.
  6176.  
  6177. 10.3.6 Floating, replaced elements
  6178.  
  6179. If 'left', 'right', 'margin-left' or 'margin-right' are specified as 'auto',
  6180. their computed value is '0'. If 'width' is 'auto', its value is the
  6181. element's intrinsic width.
  6182.  
  6183. 10.3.7 Absolutely positioned, non-replaced elements
  6184.  
  6185. The constraint that determines the computed values for these elements is:
  6186.  
  6187.      'left' + 'margin-left' + 'border-left-width' + 'padding-left' +
  6188.      'width' + 'padding-right' + 'border-right-width' + 'margin-right'
  6189.      + 'right' = width of containing block
  6190.  
  6191. (If the border style is 'none', use '0' as the border width.) The solution
  6192. to this constraint is reached through a number of substitutions in the
  6193. following order:
  6194.  
  6195.   1. If 'left' has the value 'auto' while 'direction' is 'ltr', replace
  6196.      'auto' with the distance from the left edge of the containing block to
  6197.      the left margin edge of a hypothetical box that would have been the
  6198.      first box of the element if its 'position' property had been 'static'.
  6199.      (But rather than actually computing that box, user agents are free to
  6200.      make a guess at its probable position.) The value is negative if the
  6201.      hypothetical box is to the left of the containing block.
  6202.   2. If 'right' has the value 'auto' while 'direction' is 'rtl', replace
  6203.      'auto' with the distance from the right edge of the containing block to
  6204.      the right margin edge of the same hypothetical box as above. The value
  6205.      is positive if the hypothetical box is to the left of the containing
  6206.      block's edge.
  6207.   3. If 'width' is 'auto', replace any remaining 'auto' for 'left' or
  6208.      'right' with '0'.
  6209.   4. If 'left', 'right' or 'width' are (still) 'auto', replace any 'auto' on
  6210.      'margin-left' or 'margin-right' with '0'.
  6211.   5. If at this point both 'margin-left' and 'margin-right' are still
  6212.      'auto', solve the equation under the extra constraint that the two
  6213.      margins must get equal values.
  6214.   6. If at this point there is only one 'auto' left, solve the equation for
  6215.      that value.
  6216.   7. If at this point the values are over-constrained, ignore the value for
  6217.      either 'left' (in case 'direction' is 'rtl') or 'right' (in case
  6218.      'direction' is 'ltr') and solve for that value.
  6219.  
  6220. 10.3.8 Absolutely positioned, replaced elements
  6221.  
  6222. This situation is similar to the previous one, except that the element has
  6223. an intrinsic width. The sequence of substitutions is now:
  6224.  
  6225.   1. If 'width' is 'auto', substitute the element's intrinsic width.
  6226.   2. If 'left' has the value 'auto' while 'direction' is 'ltr', replace
  6227.      'auto' with the distance from the left edge of the containing block to
  6228.      the left margin edge of a hypothetical box that would have been the
  6229.      first box of the element if its 'position' property had been 'static'.
  6230.      (But rather than actually computing that box, user agents are free to
  6231.      make a guess at its probable position.) The value is negative if the
  6232.      hypothetical box is to the left of the containing block.
  6233.   3. If 'right' has the value 'auto' while 'direction' is 'rtl', replace
  6234.      'auto' with the distance from the right edge of the containing block to
  6235.      the right margin edge of the same hypothetical box as above. The value
  6236.      is positive if the hypothetical box is to the left of the containing
  6237.      block's edge.
  6238.   4. If 'left' or 'right' are 'auto', replace any 'auto' on 'margin-left' or
  6239.      'margin-right' with '0'.
  6240.   5. If at this point both 'margin-left' and 'margin-right' are still
  6241.      'auto', solve the equation under the extra constraint that the two
  6242.      margins must get equal values.
  6243.   6. If at this point there is only one 'auto' left, solve the equation for
  6244.      that value.
  6245.   7. If at this point the values are over-constrained, ignore the value for
  6246.      either 'left' (in case 'direction' is 'rtl') or 'right' (in case
  6247.      'direction' is 'ltr') and solve for that value.
  6248.  
  6249. 10.4 Minimum and maximum widths: 'min-width' and 'max-width'
  6250.  
  6251. 'min-width'
  6252.      Value:         <length> | <percentage> | inherit
  6253.      Initial:       UA dependent
  6254.      Applies to:    all elements except non-replaced inline elements and
  6255.                     table elements
  6256.      Inherited:     no
  6257.      Percentages:   refer to width of containing block
  6258.      Media:         visual
  6259.  
  6260. 'max-width'
  6261.      Value:         <length> | <percentage> | none | inherit
  6262.      Initial:       none
  6263.      Applies to:    all elements except non-replaced inline elements and
  6264.                     table elements
  6265.      Inherited:     no
  6266.      Percentages:   refer to width of containing block
  6267.      Media:         visual
  6268.  
  6269. These two properties allow authors to constrain box widths to a certain
  6270. range. Values have the following meanings:
  6271.  
  6272. <length>
  6273.      Specifies a fixed minimum or maximum computed width.
  6274. <percentage>
  6275.      Specifies a percentage for determining the computed value. The
  6276.      percentage is calculated with respect to the width of the generated
  6277.      box's containing block.
  6278. none
  6279.      (Only on 'max-width') No limit on the width of the box.
  6280.  
  6281. The following algorithm describes how the two properties influence the
  6282. computed value of the 'width' property:
  6283.  
  6284.   1. The width is computed (without 'min-width' and 'max-width') following
  6285.      the rules under "Computing widths and margins" above.
  6286.   2. If the computed value of 'min-width' is greater than the value of
  6287.      'max-width', 'max-width' is set to the value of 'min-width'.
  6288.   3. If the computed width is greater than 'max-width', the rules above are
  6289.      applied again, but this time using the value of 'max-width' as the
  6290.      specified value for 'width'.
  6291.   4. If the computed width is smaller than 'min-width', the rules above are
  6292.      applied again, but this time using the value of 'min-width' as the
  6293.      specified value for 'width'.
  6294.  
  6295. The user agent may define a non-negative minimum value for the 'min-width'
  6296. property, which may vary from element to element and even depend on other
  6297. properties. If 'min-width' goes below this limit, either because it was set
  6298. explicitly, or because it was 'auto' and the rules below would make it too
  6299. small, the user agent may use the minimum value as the computed value.
  6300.  
  6301. 10.5 Content height: the 'height' property
  6302.  
  6303. 'height'
  6304.      Value:         <length> | <percentage> | auto | inherit
  6305.      Initial:       auto
  6306.      Applies to:    all elements but non-replaced inline elements, table
  6307.                     columns, and column groups
  6308.      Inherited:     no
  6309.      Percentages:   see prose
  6310.      Media:         visual
  6311.  
  6312. This property specifies the content height of boxes generated by block-level
  6313. and replaced elements.
  6314.  
  6315. This property does not apply to non-replaced inline-level elements. The
  6316. height of a non-replaced inline element's boxes is given by the element's
  6317. (possibly inherited) 'line-height' value.
  6318.  
  6319. Values have the following meanings:
  6320.  
  6321. <length>
  6322.      Specifies a fixed height.
  6323. <percentage>
  6324.      Specifies a percentage height. The percentage is calculated with
  6325.      respect to the height of the generated box's containing block. If the
  6326.      height of the containing block is not specified explicitly (i.e., it
  6327.      depends on content height), the value is interpreted like 'auto'.
  6328. auto
  6329.      The height depends on the values of other properties. See the prose
  6330.      below.
  6331.  
  6332. Negative values for 'height' are illegal.
  6333.  
  6334. Example(s):
  6335.  
  6336. For example, the following rule fixes the height of paragraphs to 100
  6337. pixels:
  6338.  
  6339. P { height: 100px }
  6340.  
  6341. Paragraphs that require more than 100 pixels of height will overflow
  6342. according to the 'overflow' property.
  6343.  
  6344. 10.6 Computing heights and margins
  6345.  
  6346. For computing the values of 'top', 'margin-top', 'height', 'margin-bottom',
  6347. and 'bottom' a distinction must be made between various kinds of boxes:
  6348.  
  6349.   1. inline, non-replaced elements
  6350.   2. inline, replaced elements
  6351.   3. block-level, non-replaced elements in normal flow
  6352.   4. block-level, replaced elements in normal flow
  6353.   5. floating, non-replaced elements
  6354.   6. floating, replaced elements
  6355.   7. absolutely positioned, non-replaced elements
  6356.   8. absolutely positioned, replaced elements
  6357.  
  6358. Points 1-6 include relative positioning.
  6359.  
  6360. 10.6.1 Inline, non-replaced elements
  6361.  
  6362. If 'top', 'bottom', 'margin-top', or 'margin-bottom' are 'auto', their
  6363. computed value is 0. The 'height' property doesn't apply, but the height of
  6364. the box is given by the 'line-height' property.
  6365.  
  6366. 10.6.2 Inline, replaced elements block-level, replaced elements in normal
  6367. flow, and floating, replaced elements
  6368.  
  6369. If 'top', 'bottom', 'margin-top', or 'margin-bottom' are 'auto', their
  6370. computed value is 0. If 'height' is 'auto', the computed value is the
  6371. intrinsic height.
  6372.  
  6373. 10.6.3 Block-level, non-replaced elements in normal flow, and floating,
  6374. non-replaced elements
  6375.  
  6376. If 'top', 'bottom', 'margin-top', or 'margin-bottom' are 'auto', their
  6377. computed value is 0. If 'height' is 'auto', the height depends on whether
  6378. the element has any block-level children. If it only has inline-level
  6379. children, the height is from the top of the topmost line box to the bottom
  6380. of the bottommost line box. If it has block-level children, it is the
  6381. distance from the top border-edge of the topmost block-level child box, to
  6382. the bottom border-edge of the bottommost block-level child box. Only
  6383. children in the normal flow are taken into account (i.e., floating boxes and
  6384. absolutely positioned boxes are ignored, and relatively positioned boxes are
  6385. considered without their offset). Note that the child box may be an
  6386. anonymous box.
  6387.  
  6388. 10.6.4 Absolutely positioned, non-replaced elements
  6389.  
  6390. For absolutely positioned elements, the vertical dimensions must satisfy
  6391. this constraint:
  6392.  
  6393.      'top' + 'margin-top' + 'border-top-width' + 'padding-top' +
  6394.      'height' + 'padding-bottom' + 'border-bottom-width' +
  6395.      'margin-bottom' + 'bottom' = height of containing block
  6396.  
  6397. (If the border style is 'none', use '0' as the border width.) The solution
  6398. to this constraint is reached through a number of substitutions in the
  6399. following order:
  6400.  
  6401.   1. If 'top' has the value 'auto' replace it with the distance from the top
  6402.      edge of the containing block to the top margin edge of a hypothetical
  6403.      box that would have been the first box of the element if its 'position'
  6404.      property had been 'static'. (But rather than actually computing that
  6405.      box, user agents are free to make a guess at its probable position.)
  6406.      The value is negative if the hypothetical box is above the containing
  6407.      block.
  6408.   2. If both 'height' and 'bottom' are 'auto', replace 'bottom' with 0.
  6409.   3. If 'bottom' or 'height' are (still) 'auto', replace any 'auto' on
  6410.      'margin-top' or 'margin-bottom' with '0'.
  6411.   4. If at this point both 'margin-top' and 'margin-bottom' are still
  6412.      'auto', solve the equation under the extra constraint that the two
  6413.      margins must get equal values.
  6414.   5. If at this point there is only one 'auto' left, solve the equation for
  6415.      that value.
  6416.   6. If at this point the values are over-constrained, ignore the value for
  6417.      'bottom' and solve for that value.
  6418.  
  6419. 10.6.5 Absolutely positioned, replaced elements
  6420.  
  6421. This situation is similar to the previous one, except that the element has
  6422. an intrinsic height. The sequence of substitutions is now:
  6423.  
  6424.   1. If 'height' is 'auto', substitute the element's intrinsic height.
  6425.   2. If 'top' has the value 'auto', replace it with the distance from the
  6426.      top edge of the containing block to the top margin edge of a
  6427.      hypothetical box that would have been the first box of the element if
  6428.      its 'position' property had been 'static'. (But rather than actually
  6429.      computing that box, user agents are free to make a guess at its
  6430.      probable position.) The value is negative if the hypothetical box is
  6431.      above the containing block.
  6432.   3. If 'bottom' is 'auto', replace any 'auto' on 'margin-top' or
  6433.      'margin-bottom' with '0'.
  6434.   4. If at this point both 'margin-top' and 'margin-bottom' are still
  6435.      'auto', solve the equation under the extra constraint that the two
  6436.      margins must get equal values.
  6437.   5. If at this point there is only one 'auto' left, solve the equation for
  6438.      that value.
  6439.   6. If at this point the values are over-constrained, ignore the value for
  6440.      'bottom' and solve for that value.
  6441.  
  6442. 10.7 Minimum and maximum heights: 'min-height' and 'max-height'
  6443.  
  6444. It is sometimes useful to constrain the height of elements to a certain
  6445. range. Two properties offer this functionality:
  6446.  
  6447. 'min-height'
  6448.      Value:         <length> | <percentage> | inherit
  6449.      Initial:       0
  6450.      Applies to:    all elements except non-replaced inline elements and
  6451.                     table elements
  6452.      Inherited:     no
  6453.      Percentages:   refer to height of containing block
  6454.      Media:         visual
  6455.  
  6456. 'max-height'
  6457.      Value:         <length> | <percentage> | none | inherit
  6458.      Initial:       none
  6459.      Applies to:    all elements except non-replaced inline elements and
  6460.                     table elements
  6461.      Inherited:     no
  6462.      Percentages:   refer to height of containing block
  6463.      Media:         visual
  6464.  
  6465. These two properties allow authors to constrain box heights to a certain
  6466. range. Values have the following meanings:
  6467.  
  6468. <length>
  6469.      Specifies a fixed minimum or maximum computed height.
  6470. <percentage>
  6471.      Specifies a percentage for determining the computed value. The
  6472.      percentage is calculated with respect to the height of the generated
  6473.      box's containing block. If the height of the containing block is not
  6474.      specified explicitly (i.e., it depends on content height), the
  6475.      percentage value is interpreted like 'auto'.
  6476. none
  6477.      (Only on 'max-height') No limit on the height of the box.
  6478.  
  6479. The following algorithm describes how the two properties influence the
  6480. computed value of the 'height' property:
  6481.  
  6482.   1. The height is computed (without 'min-height' and 'max-height')
  6483.      following the rules under "Computing heights and margins" above.
  6484.   2. If the computed value of 'min-height' is greater than the value of
  6485.      'max-height', 'max-height' is set to the value of 'min-height'.
  6486.   3. If the computed height is greater than 'max-height', the rules above
  6487.      are applied again, but this time using the value of 'max-height' as the
  6488.      specified value for 'height'.
  6489.   4. If the computed height is smaller than 'min-height', the rules above
  6490.      are applied again, but this time using the value of 'min-height' as the
  6491.      specified value for 'height'.
  6492.  
  6493. 10.8 Line height calculations: the 'line-height' and 'vertical-align'
  6494. properties
  6495.  
  6496. As described in the section on inline formatting contexts, user agents flow
  6497. inline boxes into a vertical stack of line boxes. The height of a line box
  6498. is determined as follows:
  6499.  
  6500.   1. The height of each inline box in the line box is calculated (see
  6501.      "Computing heights and margins" and the 'line-height' property).
  6502.   2. The inline boxes are aligned vertically according to their
  6503.      'vertical-align' property.
  6504.   3. The line box height is the distance between the uppermost box top and
  6505.      the lowermost box bottom.
  6506.  
  6507. Empty inline elements generate empty inline boxes, but these boxes still
  6508. have margins, padding, borders and a line height, and thus influence these
  6509. calculations just like elements with content.
  6510.  
  6511. Note that if all the boxes in the line box are aligned along their bottoms,
  6512. the line box will be exactly the height of the tallest box. If, however, the
  6513. boxes are aligned along a common baseline, the line box top and bottom may
  6514. not touch the top and bottom of the tallest box.
  6515.  
  6516. 10.8.1 Leading and half-leading
  6517.  
  6518. Since the height of an inline box may be different from the font size of
  6519. text in the box (e.g., 'line-height' > 1em), there may be space above and
  6520. below rendered glyphs. The difference between the font size and the computed
  6521. value of 'line-height' is called the leading. Half the leading is called the
  6522. half-leading.
  6523.  
  6524. User agents center glyphs vertically in an inline box, adding half-leading
  6525. on the top and bottom. For example, if a piece of text is '12pt' high and
  6526. the 'line-height' value is '14pt', 2pts of extra space should be added: 1pt
  6527. above and 1pt below the letters. (This applies to empty boxes as well, as if
  6528. the empty box contained an infinitely narrow letter.)
  6529.  
  6530. When the 'line-height' value is less than the font size, the final inline
  6531. box height will be less than the font size and the rendered glyphs will
  6532. "bleed" outside the box. If such a box touches the edge of a line box, the
  6533. rendered glyphs will also "bleed" into the adjacent line box.
  6534.  
  6535. Although margins, borders, and padding of non-replaced elements do not enter
  6536. into inline box height calculation (and thus the line box calculation), they
  6537. are still rendered around inline boxes. This means that if the height of a
  6538. line box is shorter than the outer edges of the boxes it contains,
  6539. backgrounds and colors of padding and borders may "bleed" into adjacent line
  6540. boxes. However, in this case, some user agents may use the line box to
  6541. "clip" the border and padding areas (i.e., not render them).
  6542.  
  6543. 'line-height'
  6544.      Value:         normal | <number> | <length> | <percentage> | inherit
  6545.      Initial:       normal
  6546.      Applies to:    all elements
  6547.      Inherited:     yes
  6548.      Percentages:   refer to the font size of the element itself
  6549.      Media:         visual
  6550.  
  6551. If the property is set on a block-level element whose content is composed of
  6552. inline-level elements, it specifies the minimal height of each generated
  6553. inline box.
  6554.  
  6555. If the property is set on an inline-level element, it specifies the exact
  6556. height of each box generated by the element. (Except for inline replaced
  6557. elements, where the height of the box is given by the 'height' property.)
  6558.  
  6559. Values for this property have the following meanings:
  6560.  
  6561. normal
  6562.      Tells user agents to set the computed value to a "reasonable" value
  6563.      based on the font size of the element. The value has the same meaning
  6564.      as <number>. We recommend a computed value for 'normal' between 1.0 to
  6565.      1.2.
  6566. <length>
  6567.      The box height is set to this length. Negative values are illegal.
  6568. <number>
  6569.      The computed value of the property is this number multiplied by the
  6570.      element's font size. Negative values are illegal. However, the number,
  6571.      not the computed value, is inherited.
  6572. <percentage>
  6573.      The computed value of the property is this percentage multiplied by the
  6574.      element's computed font size. Negative values are illegal.
  6575.  
  6576. Example(s):
  6577.  
  6578. The three rules in the example below have the same resultant line height:
  6579.  
  6580. DIV { line-height: 1.2; font-size: 10pt }     /* number */
  6581. DIV { line-height: 1.2em; font-size: 10pt }   /* length */
  6582. DIV { line-height: 120%; font-size: 10pt }    /* percentage */
  6583.  
  6584. When an element contains text that is rendered in more than one font, user
  6585. agents should determine the 'line-height' value according to the largest
  6586. font size.
  6587.  
  6588. Generally, when there is only one value of 'line-height' for all inline
  6589. boxes in a paragraph (and no tall images), the above will ensure that
  6590. baselines of successive lines are exactly 'line-height' apart. This is
  6591. important when columns of text in different fonts have to be aligned, for
  6592. example in a table.
  6593.  
  6594. Note that replaced elements have a 'font-size' and a 'line-height' property,
  6595. even if they are not used directly to determine the height of the box. The
  6596. 'font-size' is, however, used to define the 'em' and 'ex' units, and the
  6597. 'line-height' has a role in the 'vertical-align' property.
  6598.  
  6599. 'vertical-align'
  6600.      Value:         baseline | sub | super | top | text-top | middle |
  6601.                     bottom | text-bottom | <percentage> | <length> | inherit
  6602.      Initial:       baseline
  6603.      Applies to:    inline-level and 'table-cell' elements
  6604.      Inherited:     no
  6605.      Percentages:   refer to the 'line-height' of the element itself
  6606.      Media:         visual
  6607.  
  6608. This property affects the vertical positioning inside a line box of the
  6609. boxes generated by an inline-level element. The following values only have
  6610. meaning with respect to a parent inline-level element, or to a parent
  6611. block-level element, if that element generates anonymous inline boxes; they
  6612. have no effect if no such parent exists.
  6613.  
  6614. Note. Values of this property have slightly different meanings in the
  6615. context of tables. Please consult the section on table height algorithms for
  6616. details.
  6617.  
  6618. baseline
  6619.      Align the baseline of the box with the baseline of the parent box. If
  6620.      the box doesn't have a baseline, align the bottom of the box with the
  6621.      parent's baseline.
  6622. middle
  6623.      Align the vertical midpoint of the box with the baseline of the parent
  6624.      box plus half the x-height of the parent.
  6625. sub
  6626.      Lower the baseline of the box to the proper position for subscripts of
  6627.      the parent's box. (This value has no effect on the font size of the
  6628.      element's text.)
  6629. super
  6630.      Raise the baseline of the box to the proper position for superscripts
  6631.      of the parent's box. (This value has no effect on the font size of the
  6632.      element's text.)
  6633. text-top
  6634.      Align the top of the box with the top of the parent element's font.
  6635. text-bottom
  6636.      Align the bottom of the box with the bottom of the parent element's
  6637.      font.
  6638. <percentage>
  6639.      Raise (positive value) or lower (negative value) the box by this
  6640.      distance (a percentage of the 'line-height' value). The value '0%'
  6641.      means the same as 'baseline'.
  6642. <length>
  6643.      Raise (positive value) or lower (negative value) the box by this
  6644.      distance. The value '0cm' means the same as 'baseline'.
  6645.  
  6646. The remaining values refer to the line box in which the generated box
  6647. appears:
  6648.  
  6649. top
  6650.      Align the top of the box with the top of the line box.
  6651. bottom
  6652.      Align the bottom of the box with the bottom of the line box.
  6653.  
  6654.   ------------------------------------------------------------------------
  6655.   ------------------------------------------------------------------------
  6656.  
  6657.                               11 Visual effects
  6658.  
  6659. Contents
  6660.  
  6661.    * 11.1 Overflow and clipping
  6662.         o 11.1.1 Overflow: the 'overflow' property
  6663.         o 11.1.2 Clipping: the 'clip' property
  6664.    * 11.2 Visibility: the 'visibility' property
  6665.  
  6666. 11.1 Overflow and clipping
  6667.  
  6668. Generally, the content of a block box is confined to the content edges of
  6669. the box. In certain cases, a box may overflow, meaning its content lies
  6670. partly or entirely outside of the box, e.g.:
  6671.  
  6672.    * A line cannot be broken, causing the line box to be wider than the
  6673.      block box.
  6674.    * A block-level box is too wide for the containing block. This may happen
  6675.      when an element's 'width' property has a value that causes the
  6676.      generated block box to spill over sides of the containing block.
  6677.    * An element's height exceeds an explicit height assigned to the
  6678.      containing block (i.e., the containing block's height is determined by
  6679.      the 'height' property, not by content height).
  6680.    * A box is positioned absolutely.
  6681.    * It has negative margins.
  6682.  
  6683. Whenever overflow occurs, the 'overflow' property specifies how (and
  6684. whether) a box is clipped. The 'clip' property specifies the size and shape
  6685. of the clipping region. Specifying a small clipping region may cause
  6686. clipping of otherwise visible contents.
  6687.  
  6688. 11.1.1 Overflow: the 'overflow' property
  6689.  
  6690. 'overflow'
  6691.      Value:         visible | hidden | scroll | auto | inherit
  6692.      Initial:       visible
  6693.      Applies to:    block-level and replaced elements
  6694.      Inherited:     no
  6695.      Percentages:   N/A
  6696.      Media:         visual
  6697.  
  6698. This property specifies whether the content of a block-level element is
  6699. clipped when it overflows the element's box (which is acting as a containing
  6700. block for the content). Values have the following meanings:
  6701.  
  6702. visible
  6703.      This value indicates that content is not clipped, i.e., it may be
  6704.      rendered outside the block box.
  6705. hidden
  6706.      This value indicates that the content is clipped and that no scrolling
  6707.      mechanism should be provided to view the content outside the clipping
  6708.      region; users will not have access to clipped content. The size and
  6709.      shape of the clipping region is specified by the 'clip' property.
  6710. scroll
  6711.      This value indicates that the content is clipped and that if the user
  6712.      agent uses scrolling mechanism that is visible on the screen (such as a
  6713.      scroll bar or a panner), that mechanism should be displayed for a box
  6714.      whether or not any of its content is clipped. This avoids any problem
  6715.      with scrollbars appearing and disappearing in a dynamic environment.
  6716.      When this value is specified and the target medium is 'print' or
  6717.      'projection', overflowing content should be printed.
  6718. auto
  6719.      The behavior of the 'auto' value is user agent-dependent, but should
  6720.      cause a scrolling mechanism to be provided for overflowing boxes.
  6721.  
  6722. Even if 'overflow' is set to 'visible', content may be clipped to a UA's
  6723. document window by the native operating environment.
  6724.  
  6725. Example(s):
  6726.  
  6727. Consider the following example of a block quotation (BLOCKQUOTE) that is too
  6728. big for its containing block (established by a DIV). Here is the source
  6729. document:
  6730.  
  6731. <DIV>
  6732. <BLOCKQUOTE>
  6733. <P>I didn't like the play, but then I saw
  6734. it under adverse conditions - the curtain was up.
  6735. <DIV class="attributed-to">- Groucho Marx</DIV>
  6736. </BLOCKQUOTE>
  6737. </DIV>
  6738.  
  6739. Here is the style sheet controlling the sizes and style of the generated
  6740. boxes:
  6741.  
  6742. DIV { width : 100px; height: 100px;
  6743.       border: thin solid red;
  6744.       }
  6745.  
  6746. BLOCKQUOTE   { width : 125px; height : 100px;
  6747.       margin-top: 50px; margin-left: 50px;
  6748.       border: thin dashed black
  6749.       }
  6750.  
  6751. DIV.attributed-to { text-align : right; }
  6752.  
  6753. The initial value of 'overflow' is 'visible', so the BLOCKQUOTE would be
  6754. formatted without clipping, something like this:
  6755.  
  6756. [Rendered overflow]   [D]
  6757.  
  6758. Setting 'overflow' to 'hidden' for the DIV element, on the other hand,
  6759. causes the BLOCKQUOTE to be clipped by the containing block:
  6760.  
  6761. [Clipped overflow]   [D]
  6762.  
  6763. A value of 'scroll' would tell UAs that support a visible scrolling
  6764. mechanism to display one so that users could access the clipped content.
  6765.  
  6766. 11.1.2 Clipping: the 'clip' property
  6767.  
  6768. A clipping region defines what portion of an element's rendered content is
  6769. visible. By default, the clipping region has the same size and shape as the
  6770. element's box(es). However, the clipping region may be modified by the
  6771. 'clip' property.
  6772.  
  6773. 'clip'
  6774.      Value:         <shape> | auto | inherit
  6775.      Initial:       auto
  6776.      Applies to:    block-level and replaced elements
  6777.      Inherited:     no
  6778.      Percentages:   N/A
  6779.      Media:         visual
  6780.  
  6781. The 'clip' property applies to elements that have a 'overflow' property with
  6782. a value other than 'visible'. Values have the following meanings:
  6783.  
  6784. auto
  6785.      The clipping region has the same size and location as the element's
  6786.      box(es).
  6787. <shape>
  6788.      In CSS2, the only valid <shape> value is: rect (<top> <right> <bottom>
  6789.      <left>) where <top>, <bottom> <right>, and <left> specify offsets from
  6790.      the respective sides of the box.
  6791.  
  6792.      <top>, <right>, <bottom>, and <left> may either have a <length> value
  6793.      or 'auto'. Negative lengths are permitted. The value 'auto' means that
  6794.      a given edge of the clipping region will be the same as the edge of the
  6795.      element's generated box (i.e., 'auto' means the same as '0'.)
  6796.  
  6797.      When coordinates are rounded to pixel coordinates, care should be taken
  6798.      that no pixels remain visible when <left> + <right> is equal to the
  6799.      element's width (or <top> + <bottom> equals the element's height), and
  6800.      conversely that no pixels remain hidden when these values are 0.
  6801.  
  6802. The element's ancestors may also have clipping regions (in case their
  6803. 'overflow' property is not 'visible'); what is rendered is the intersection
  6804. of the various clipping regions.
  6805.  
  6806. If the clipping region exceeds the bounds of the UA's document window,
  6807. content may be clipped to that window by the native operating environment.
  6808.  
  6809. Example(s):
  6810.  
  6811. The following two rules:
  6812.  
  6813. P { clip: rect(5px, 10px, 10px, 5px); }
  6814. P { clip: rect(5px, -5px, 10px, 5px); }
  6815.  
  6816. will create the rectangular clipping regions delimited by the dashed lines
  6817. in the following illustrations:
  6818.  
  6819. [Two clipping regions]   [D]
  6820.  
  6821. Note. In CSS2, all clipping regions are rectangular. We anticipate future
  6822. extensions to permit non-rectangular clipping.
  6823.  
  6824. 11.2 Visibility: the 'visibility' property
  6825.  
  6826. 'visibility'
  6827.      Value:         visible | hidden | collapse | inherit
  6828.      Initial:       inherit
  6829.      Applies to:    all elements
  6830.      Inherited:     no
  6831.      Percentages:   N/A
  6832.      Media:         visual
  6833.  
  6834. The 'visibility' property specifies whether the boxes generated by an
  6835. element are rendered. Invisible boxes still affect layout (set the 'display'
  6836. property to 'none' to suppress box generation altogether). Values have the
  6837. following meanings:
  6838.  
  6839. visible
  6840.      The generated box is visible.
  6841. hidden
  6842.      The generated box is invisible (fully transparent), but still affects
  6843.      layout.
  6844. collapse
  6845.      Please consult the section on dynamic row and column effects in tables.
  6846.      If used on elements other than rows or columns, 'collapse' has the same
  6847.      meaning as 'hidden'.
  6848.  
  6849. This property may be used in conjunction with scripts to create dynamic
  6850. effects.
  6851.  
  6852. In the following example, pressing either form button invokes a user-defined
  6853. script function that causes the corresponding box to become visible and the
  6854. other to be hidden. Since these boxes have the same size and position, the
  6855. effect is that one replaces the other. (The script code is in a hypothetical
  6856. script language. It may or may not have any effect in a CSS-capable UA.)
  6857.  
  6858. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  6859. <HTML>
  6860. <HEAD>
  6861. <STYLE type="text/css">
  6862. <!--
  6863.    #container1 { position: absolute;
  6864.                  top: 2in; left: 2in; width: 2in }
  6865.    #container2 { position: absolute;
  6866.                  top: 2in; left: 2in; width: 2in;
  6867.                  visibility: hidden; }
  6868. -->
  6869. </STYLE>
  6870. </HEAD>
  6871. <BODY>
  6872. <P>Choose a suspect:</P>
  6873. <DIV id="container1">
  6874.    <IMG alt="Al Capone"
  6875.         width="100" height="100"
  6876.         src="suspect1.jpg">
  6877.    <P>Name: Al Capone</P>
  6878.    <P>Residence: Chicago</P>
  6879. </DIV>
  6880.  
  6881. <DIV id="container2">
  6882.    <IMG alt="Lucky Luciano"
  6883.         width="100" height="100"
  6884.         src="suspect2.jpg">
  6885.    <P>Name: Lucky Luciano</P>
  6886.    <P>Residence: New York</P>
  6887. </DIV>
  6888.  
  6889. <FORM method="post"
  6890.       action="http://www.suspect.org/process-bums">
  6891.    <P>
  6892.    <INPUT name="Capone" type="button"
  6893.           value="Capone"
  6894.           onclick='show("container1");hide("container2")'>
  6895.    <INPUT name="Luciano" type="button"
  6896.           value="Luciano"
  6897.           onclick='show("container2");hide("container1")'>
  6898. </FORM>
  6899. </BODY>
  6900. </HTML>
  6901.  
  6902.   ------------------------------------------------------------------------
  6903.   ------------------------------------------------------------------------
  6904.  
  6905.             12 Generated content, automatic numbering, and lists
  6906.  
  6907. Contents
  6908.  
  6909.    * 12.1 The :before and :after pseudo-elements
  6910.    * 12.2 The 'content' property
  6911.    * 12.3 Interaction of :before and :after with 'compact' and 'run-in'
  6912.      elements
  6913.    * 12.4 Quotation marks
  6914.         o 12.4.1 Specifying quotes with the 'quotes' property
  6915.         o 12.4.2 Inserting quotes with the 'content' property
  6916.    * 12.5 Automatic counters and numbering
  6917.         o 12.5.1 Nested counters and scope
  6918.         o 12.5.2 Counter styles
  6919.         o 12.5.3 Counters in elements with 'display: none'
  6920.    * 12.6 Markers and lists
  6921.         o 12.6.1 Markers: the 'marker-offset' property
  6922.         o 12.6.2 Lists: the 'list-style-type', 'list-style-image',
  6923.           'list-style-position', and 'list-style' properties
  6924.  
  6925. In some cases, authors may want user agents to render content that does not
  6926. come from the document tree. One familiar example of this is a numbered
  6927. list; the author does not want to list the numbers explicitly, he or she
  6928. wants the user agent to generate them automatically. Similarly, authors may
  6929. want the user agent to insert the word "Figure" before the caption of a
  6930. figure, or "Chapter 7" before the seventh chapter title. For audio or
  6931. braille in particular, user agents should be able to insert these strings.
  6932.  
  6933. In CSS2, content may be generated by several mechanisms:
  6934.  
  6935.    * The 'content' property, in conjunction with the :before and :after
  6936.      pseudo-elements.
  6937.    * The 'cue-before', 'cue-after' aural properties (see the chapter on
  6938.      aural style sheets). When the 'content' property is combined with the
  6939.      aural properties they are rendered in the following order: :before,
  6940.      'cue-before', ('pause-before'), the element's content, ('pause-after'),
  6941.      'cue-after', and :after.
  6942.    * Elements with a value of 'list-item' for the 'display' property.
  6943.  
  6944. Below we describe the mechanisms associated with the 'content' property.
  6945.  
  6946. 12.1 The :before and :after pseudo-elements
  6947.  
  6948. Authors specify the style and location of generated content with the :before
  6949. and :after pseudo-elements. As their names indicate, the :before and :after
  6950. pseudo-elements specify the location of content before and after an
  6951. element's document tree content. The 'content' property, in conjunction with
  6952. these pseudo-elements, specifies what is inserted.
  6953.  
  6954. Example(s):
  6955.  
  6956. For example, the following rule inserts the string "Note: " before the
  6957. content of every P element whose "class" attribute has the value "note":
  6958.  
  6959. P.note:before { content: "Note: " }
  6960.  
  6961. The formatting objects (e.g., boxes) generated by an element include
  6962. generated content. So, for example, changing the above style sheet to:
  6963.  
  6964. P.note:before { content: "Note: " }
  6965. P.note        { border: solid green }
  6966.  
  6967. would cause a solid green border to be rendered around the entire paragraph,
  6968. including the initial string.
  6969.  
  6970. The :before and :after pseudo-elements inherit any inheritable properties
  6971. from the element in the document tree to which they are attached.
  6972.  
  6973. Example(s):
  6974.  
  6975. For example, the following rules insert an open quote mark before every Q
  6976. element. The color of the quote mark will be red, but the font will be the
  6977. same as the font of the rest of the Q element:
  6978.  
  6979. Q:before {
  6980.   content: open-quote;
  6981.   color: red
  6982. }
  6983.  
  6984. In a :before or :after pseudo-element declaration, non-inherited properties
  6985. take their initial values.
  6986.  
  6987. Example(s):
  6988.  
  6989. So, for example, because the initial value of the 'display' property is
  6990. 'inline', the quote in the previous example is inserted as an inline box
  6991. (i.e., on the same line as the element's initial text content). The next
  6992. example explicitly sets the 'display' property to 'block', so that the
  6993. inserted text becomes a block:
  6994.  
  6995. BODY:after {
  6996.     content: "The End";
  6997.     display: block;
  6998.     margin-top: 2em;
  6999.     text-align: center;
  7000. }
  7001.  
  7002. Note that an audio user agent would speak the words "The End" after
  7003. rendering the rest of the BODY content.
  7004.  
  7005. User agents must ignore the following properties with :before and :after
  7006. pseudo-elements: 'position', 'float', list properties, and table properties.
  7007.  
  7008. The :before and :after pseudo-elements elements allow values of the
  7009. 'display' property as follows:
  7010.  
  7011.    * If the subject of the selector is a block-level element, allowed values
  7012.      are 'none', 'inline', 'block', and 'marker'. If the value of the
  7013.      'display' has any other value, the pseudo-element will behave as if the
  7014.      value were 'block'.
  7015.    * If the subject of the selector is an inline-level element, allowed
  7016.      values are 'none' and 'inline'. If the value of the 'display' has any
  7017.      other value, the pseudo-element will behave as if the value were
  7018.      'inline'.
  7019.  
  7020. Note. Other values may be permitted in future levels of CSS.
  7021.  
  7022. 12.2 The 'content' property
  7023.  
  7024. 'content'
  7025.      Value:         [ <string> | <uri> | <counter> | attr(X) | open-quote |
  7026.                     close-quote | no-open-quote | no-close-quote ]+ |
  7027.                     inherit
  7028.      Initial:       empty string
  7029.      Applies to:    :before and :after pseudo-elements
  7030.      Inherited:     no
  7031.      Percentages:   N/A
  7032.      Media:         all
  7033.  
  7034. This property is used with the :before and :after pseudo-elements to
  7035. generate content in a document. Values have the following meanings:
  7036.  
  7037. <string>
  7038.      Text content (see the section on strings).
  7039. <uri>
  7040.      The value is a URI that designates an external resource. If a user
  7041.      agent cannot support the resource because of the media types it
  7042.      supports, it must ignore the resource. Note. CSS2 offers no mechanism
  7043.      to change the size of the embedded object, or to provide a textual
  7044.      description, like the "alt" or "longdesc" attributes do for images in
  7045.      HTML. This may change in future levels of CSS.
  7046. <counter>
  7047.      Counters may be specified with two different functions: 'counter()' or
  7048.      'counters()'. The former has two forms: 'counter(name)' or
  7049.      'counter(name, style)'. The generated text is the value of the named
  7050.      counter at this point in the formatting structure; it is formatted in
  7051.      the indicated style ('decimal' by default). The latter function also
  7052.      has two forms: 'counter(name, string)' or 'counter(name, string,
  7053.      style)'. The generated text is the value of all counters with the given
  7054.      name at this point in the formatting structure, separated by the
  7055.      specified string. The counters are rendered in the indicated style
  7056.      ('decimal' by default). See the section on automatic counters and
  7057.      numbering for more information.
  7058. open-quote and close-quote
  7059.      These values are replaced by the appropriate string from the 'quotes'
  7060.      property.
  7061. no-open-quote and no-close-quote
  7062.      Inserts nothing (the empty string), but increments (decrements) the
  7063.      level of nesting for quotes.
  7064. attr(X)
  7065.      This function returns as a string the value of attribute X for the
  7066.      subject of the selector. The string is not parsed by the CSS processor.
  7067.      If the subject of the selector doesn't have an attribute X, an empty
  7068.      string is returned. The case-sensitivity of attribute names depends on
  7069.      the document language. Note. In CSS2, it is not possible to refer to
  7070.      attribute values for other elements of the selector.
  7071.  
  7072. The 'display' property controls whether the content is placed in a block,
  7073. inline, or marker box.
  7074.  
  7075. Authors should put 'content' declarations in @media rules when the content
  7076. is media-sensitive. For instance, literal text may be used for any media
  7077. group, but images only apply to the visual + bitmap media groups, and sound
  7078. files only apply to the aural media group.
  7079.  
  7080. Example(s):
  7081.  
  7082. The following rule causes a sound file to be played at the end of a
  7083. quotation (see the section on aural style sheets for additional mechanisms):
  7084.  
  7085. @media aural {
  7086.    BLOCKQUOTE:after { content: url("beautiful-music.wav") }
  7087.    }
  7088.  
  7089. Example(s):
  7090.  
  7091. The next rule inserts the text of the HTML "alt" attribute before the image.
  7092. If the image is not displayed, the reader will still see the "alt" text.
  7093.  
  7094. IMG:before { content: attr(alt) }
  7095.  
  7096. Authors may include newlines in the generated content by writing the "\A"
  7097. escape sequence in one of the strings after the 'content' property. This
  7098. inserts a forced line break, similar to the BR element in HTML. See
  7099. "Strings" and "Characters and case" for more information on the "\A" escape
  7100. sequence.
  7101.  
  7102. Example(s):
  7103.  
  7104. H1:before {
  7105.     display: block;
  7106.     text-align: center;
  7107.     content: "chapter\A hoofdstuk\A chapitre"
  7108. }
  7109.  
  7110. Generated content does not alter the document tree. In particular, it is not
  7111. fed back to the document language processor (e.g., for reparsing).
  7112.  
  7113. Note. In future levels of CSS, the 'content' property may accept additional
  7114. values, allowing it to vary the style of pieces of the generated content,
  7115. but in CSS2, all the content of the :before or :after pseudo-element has the
  7116. same style.
  7117.  
  7118. 12.3 Interaction of :before and :after with 'compact' and 'run-in' elements
  7119.  
  7120. The following cases can occur:
  7121.  
  7122.   1. A 'run-in' or 'compact' element has a :before pseudo-element of type
  7123.      'inline': the pseudo-element is taken into account when the size of the
  7124.      element's box is computed (for 'compact') and is rendered inside the
  7125.      same block box as the element.
  7126.   2. A 'run-in' or 'compact' element has an :after pseudo-element of type
  7127.      'inline': The rules of the previous point apply.
  7128.   3. A 'run-in' or 'compact' element has a :before pseudo-element of type
  7129.      'block': the pseudo-element is formatted as a block above the element,
  7130.      and does not take part in the computation of the element's size (for
  7131.      'compact').
  7132.   4. A 'run-in' or 'compact' element has an :after pseudo-element of type
  7133.      'block': both the element and its :after pseudo-element are formatted
  7134.      as block boxes. The element is not formatted as an inline box in its
  7135.      own :after pseudo-element.
  7136.   5. The element following a 'run-in' or 'compact' element has a :before of
  7137.      type 'block': the decision how to format the 'run-in'/'compact' element
  7138.      is made with respect to the block box resulting from the :before
  7139.      pseudo-element.
  7140.   6. The element following a 'run-in' or 'compact' element has an :before of
  7141.      type 'inline': the decision how to format the 'run-in'/'compact'
  7142.      element depends on the 'display' value of the element to which the
  7143.      :before is attached.
  7144.  
  7145. Example(s):
  7146.  
  7147. Here is an example of a 'run-in' header with an :after pseudo-element,
  7148. followed by a paragraph with a :before pseudo-element. All pseudo-elements
  7149. are inline (the default) in this example. When the style sheet:
  7150.  
  7151. H3 { display: run-in }
  7152. H3:after { content: ": " }
  7153. P:before { content: "... " }
  7154.  
  7155. is applied to this source document:
  7156.  
  7157. <H3>Centaurs</H3>
  7158. <P>have hoofs
  7159. <P>have a tail
  7160.  
  7161. The visual formatting will resemble:
  7162.  
  7163. Centaurs: ... have hoofs
  7164. ... have a tail
  7165.  
  7166. 12.4 Quotation marks
  7167.  
  7168. In CSS2, authors may specify, in a style-sensitive and context-dependent
  7169. manner, how user agents should render quotation marks. The 'quotes' property
  7170. specifies pairs of quotation marks for each level of embedded quotation. The
  7171. 'content' property gives access to those quotation marks and causes them to
  7172. be inserted before and after a quotation.
  7173.  
  7174. 12.4.1 Specifying quotes with the 'quotes' property
  7175.  
  7176. 'quotes'
  7177.      Value:         [<string> <string>]+ | none | inherit
  7178.      Initial:       depends on user agent
  7179.      Applies to:    all elements
  7180.      Inherited:     yes
  7181.      Percentages:   N/A
  7182.      Media:         visual
  7183.  
  7184. This property specifies quotation marks for any number of embedded
  7185. quotations. Values have the following meanings:
  7186.  
  7187. none
  7188.      The 'open-quote' and 'close-quote' values of the 'content' property
  7189.      produce no quotations marks.
  7190. [<string>  <string>]+
  7191.      Values for the 'open-quote' and 'close-quote' values of the 'content'
  7192.      property are taken from this list of pairs of quotation marks (opening
  7193.      and closing). The first (leftmost) pair represents the outermost level
  7194.      of quotation, the second pair the first level of embedding, etc. The
  7195.      user agent must apply the appropriate pair of quotation marks according
  7196.      to the level of embedding.
  7197.  
  7198. Example(s):
  7199.  
  7200. For example, applying the following style sheet:
  7201.  
  7202. /* Specify pairs of quotes for two levels in two languages */
  7203. Q:lang(en) { quotes: '"' '"' "'" "'" }
  7204. Q:lang(no) { quotes: "´" "ª" "<" ">" }
  7205.  
  7206. /* Insert quotes before and after Q element content */
  7207. Q:before { content: open-quote }
  7208. Q:after  { content: close-quote }
  7209.  
  7210. to the following HTML fragment:
  7211.  
  7212. <HTML lang="en">
  7213.   <HEAD>
  7214.   <TITLE>Quotes</TITLE>
  7215.   </HEAD>
  7216.   <BODY>
  7217.     <P><Q>Quote me!</Q>
  7218.   </BODY>
  7219. </HTML>
  7220.  
  7221. would allow a user agent to produce:
  7222.  
  7223. "Quote me!"
  7224.  
  7225. while this HTML fragment:
  7226.  
  7227. <HTML lang="no">
  7228.   <HEAD>
  7229.   <TITLE>Quotes</TITLE>
  7230.   </HEAD>
  7231.   <BODY>
  7232.     <P><Q>Tr¯ndere grÂter nÂr <Q>Vinsjan p kaia</Q> blir deklamert.</Q>
  7233.   </BODY>
  7234. </HTML>
  7235.  
  7236. would produce:
  7237.  
  7238. ´Tr¯ndere grÂter nÂr <Vinsjan p kaia> blir deklamert.ª
  7239.  
  7240. Note. While the quotation marks specified by 'quotes' in the previous
  7241. examples are conveniently located on computer keyboards, high quality
  7242. typesetting would require different ISO 10646 characters. The following
  7243. informative table lists some of the ISO 10646 quotation mark characters:
  7244.  
  7245.      Approximate      ISO 10646 code
  7246.       rendering            (hex)                   Description
  7247.  
  7248.  "                    0022            QUOTATION MARK [the ASCII double
  7249.                                       quotation mark]
  7250.  
  7251.  '                    0027            APOSTROPHE [the ASCII single
  7252.                                       quotation mark]
  7253.  
  7254.  <                    2039            SINGLE LEFT-POINTING ANGLE QUOTATION
  7255.                                       MARK
  7256.  
  7257.  >                    203A            SINGLE RIGHT-POINTING ANGLE QUOTATION
  7258.                                       MARK
  7259.  
  7260.  ´                    00AB            LEFT-POINTING DOUBLE ANGLE QUOTATION
  7261.                                       MARK
  7262.  
  7263.  ª                    00BB            RIGHT-POINTING DOUBLE ANGLE QUOTATION
  7264.                                       MARK
  7265.  
  7266.  `                    2018            LEFT SINGLE QUOTATION MARK [single
  7267.                                       high-6]
  7268.  
  7269.  '                    2019            RIGHT SINGLE QUOTATION MARK [single
  7270.                                       high-9]
  7271.  
  7272.  ``                   201C            LEFT DOUBLE QUOTATION MARK [double
  7273.                                       high-6]
  7274.  
  7275.  ''                   201D            RIGHT DOUBLE QUOTATION MARK [double
  7276.                                       high-9]
  7277.  
  7278.  ,,                   201E            DOUBLE LOW-9 QUOTATION MARK [double
  7279.                                       low-9]
  7280.  
  7281. 12.4.2 Inserting quotes with the 'content' property
  7282.  
  7283. Quotation marks are inserted in appropriate places in a document with the
  7284. 'open-quote' and 'close-quote' values of the 'content' property. Each
  7285. occurrence of 'open-quote' or 'close-quote' is replaced by one of the
  7286. strings from the value of 'quotes', based on the depth of nesting.
  7287.  
  7288. 'Open-quote' refers to the first of a pair of quotes, 'close-quote' refers
  7289. to the second. Which pair of quotes is used depends on the nesting level of
  7290. quotes: the number of occurrences of 'open-quote' in all generated text
  7291. before the current occurrence, minus the number of occurrences of
  7292. 'close-quote'. If the depth is 0, the first pair is used, if the depth is 1,
  7293. the second pair is used, etc. If the depth is greater than the number of
  7294. pairs, the last pair is repeated.
  7295.  
  7296. Note that this quoting depth is independent of the nesting of the source
  7297. document or the formatting structure.
  7298.  
  7299. Some typographic styles require open quotation marks to be repeated before
  7300. every paragraph of a quote spanning several paragraphs, but only the last
  7301. paragraph ends with a closing quotation mark. In CSS, this can be achieved
  7302. by inserting "phantom" closing quotes. The keyword 'no-close-quote'
  7303. decrements the quoting level, but does not insert a quotation mark.
  7304.  
  7305. Example(s):
  7306.  
  7307. The following style sheet puts opening quotation marks on every paragraph in
  7308. a BLOCKQUOTE, and inserts a single closing quote at the end:
  7309.  
  7310. BLOCKQUOTE P:before     { content: open-quote }
  7311. BLOCKQUOTE P:after      { content: no-close-quote }
  7312. BLOCKQUOTE P.last:after { content: close-quote }
  7313.  
  7314. This relies on the last paragraph being marked with a class "last", since
  7315. there are no selectors that can match the last child of an element.
  7316.  
  7317. For symmetry, there is also a 'no-open-quote' keyword, which inserts
  7318. nothing, but increments the quotation depth by one.
  7319.  
  7320. Note. If a quotation is in a different language than the surrounding text,
  7321. it is customary to quote the text with the quote marks of the language of
  7322. the surrounding text, not the language of the quotation itself.
  7323.  
  7324. Example(s):
  7325.  
  7326. For example, French inside English:
  7327.  
  7328.      The device of the order of the garter is "Honi soit qui mal y
  7329.      pense."
  7330.  
  7331. English inside French:
  7332.  
  7333.      Il disait: ´ Il faut mettre l'action en < fast forward >.ª
  7334.  
  7335. A style sheet like the following will set the 'quotes' property so that
  7336. 'open-quote' and 'close-quote' will work correctly on all elements. These
  7337. rules are for documents that contain only English, French, or both. One rule
  7338. is needed for every additional language. Note the use of the child
  7339. combinator (">") to set quotes on elements based on the language of the
  7340. surrounding text:
  7341.  
  7342. [LANG|=fr] > *  { quotes: "´" "ª" "\2039" "\203A" }
  7343. [LANG|=en] > *  { quotes: "\201C" "\201D" "\2018" "\2019" }
  7344.  
  7345. The quotation marks for English are shown here in a form that most people
  7346. will be able to type. If you can type them directly, they will look like
  7347. this:
  7348.  
  7349. [LANG|=fr] > * { quotes: "´" "ª" "<" ">" }
  7350. [LANG|=en] > * { quotes: """ """ "`" "'" }
  7351.  
  7352. 12.5 Automatic counters and numbering
  7353.  
  7354. Automatic numbering in CSS2 is controlled with two properties,
  7355. 'counter-increment' and 'counter-reset'. The counters defined by these
  7356. properties are used with the counter() and counters() functions of the the
  7357. 'content' property.
  7358.  
  7359. 'counter-reset'
  7360.      Value:         [ <identifier> <integer>? ]+ | none | inherit
  7361.      Initial:       none
  7362.      Applies to:    all elements
  7363.      Inherited:     no
  7364.      Percentages:   N/A
  7365.      Media:         all
  7366.  
  7367. 'counter-increment'
  7368.      Value:         [ <identifier> <integer>? ]+ | none | inherit
  7369.      Initial:       none
  7370.      Applies to:    all elements
  7371.      Inherited:     no
  7372.      Percentages:   N/A
  7373.      Media:         all
  7374.  
  7375. The 'counter-increment' property accepts one or more names of counters
  7376. (identifiers), each one optionally followed by an integer. The integer
  7377. indicates by how much the counter is incremented for every occurrence of the
  7378. element. The default increment is 1. Zero and negative integers are allowed.
  7379.  
  7380. The 'counter-reset' property also contains a list of one or more names of
  7381. counters, each one optionally followed by an integer. The integer gives the
  7382. value that the counter is set to on each occurrence of the element. The
  7383. default is 0.
  7384.  
  7385. If 'counter-increment' refers to a counter that is not in the scope (see
  7386. below) of any 'counter-reset', the counter is assumed to have been reset to
  7387. 0 by the root element.
  7388.  
  7389. Example(s):
  7390.  
  7391. This example shows a way to number chapters and sections with "Chapter 1",
  7392. "1.1", "1.2", etc.
  7393.  
  7394. H1:before {
  7395.     content: "Chapter " counter(chapter) ". ";
  7396.     counter-increment: chapter;  /* Add 1 to chapter */
  7397.     counter-reset: section;      /* Set section to 0 */
  7398. }
  7399. H2:before {
  7400.     content: counter(chapter) "." counter(section) " ";
  7401.     counter-increment: section;
  7402. }
  7403.  
  7404. If an element increments/resets a counter and also uses it (in the 'content'
  7405. property of its :before or :after pseudo-element), the counter is used after
  7406. being incremented/reset.
  7407.  
  7408. If an element both resets and increments a counter, the counter is reset
  7409. first and then incremented.
  7410.  
  7411. The 'counter-reset' property follows the cascading rules. Thus, due to
  7412. cascading, the following style sheet:
  7413.  
  7414. H1 { counter-reset: section -1 }
  7415. H1 { counter-reset: imagenum 99 }
  7416.  
  7417. will only reset 'imagenum'. To reset both counters, they have to be
  7418. specified together:
  7419.  
  7420. H1 { counter-reset: section -1 imagenum 99 }
  7421.  
  7422. 12.5.1 Nested counters and scope
  7423.  
  7424. Counters are "self-nesting", in the sense that re-using a counter in a child
  7425. element automatically creates a new instance of the counter. This is
  7426. important for situations like lists in HTML, where elements can be nested
  7427. inside themselves to arbitrary depth. It would be impossible to define
  7428. uniquely named counters for each level.
  7429.  
  7430. Example(s):
  7431.  
  7432. Thus, the following suffices to number nested list items. The result is very
  7433. similar to that of setting 'display:list-item' and 'list-style: inside' on
  7434. the LI element:
  7435.  
  7436. OL { counter-reset: item }
  7437. LI { display: block }
  7438. LI:before { content: counter(item) ". "; counter-increment: item }
  7439.  
  7440. The self-nesting is based on the principle that every element that has a
  7441. 'counter-reset' for a counter X, creates a fresh counter X, the scope of
  7442. which is the element, its preceding siblings, and all the descendants of the
  7443. element and its preceding siblings.
  7444.  
  7445. In the example above, an OL will create a counter, and all children of the
  7446. OL will refer to that counter.
  7447.  
  7448. If we denote by item[n] the nth instance of the "item" counter, and by "("
  7449. and ")" the beginning and end of a scope, then the following HTML fragment
  7450. will use the indicated counters. (We assume the style sheet as given in the
  7451. example above).
  7452.  
  7453. <OL>               <!-- (set item[0] to 0          -->
  7454.   <LI>item         <!--  increment item[0] (= 1)   -->
  7455.   <LI>item         <!--  increment item[0] (= 2)   -->
  7456.     <OL>           <!--  (set item[1] to 0         -->
  7457.       <LI>item     <!--   increment item[1] (= 1)  -->
  7458.       <LI>item     <!--   increment item[1] (= 2)  -->
  7459.       <LI>item     <!--   increment item[1] (= 3)  -->
  7460.         <OL>       <!--   (set item[2] to 0        -->
  7461.           <LI>item <!--    increment item[2] (= 1) -->
  7462.         </OL>      <!--   )                        -->
  7463.         <OL>       <!--   (set item[3] to 0        -->
  7464.           <LI>     <!--    increment item[3] (= 1) -->
  7465.         </OL>      <!--   )                        -->
  7466.       <LI>item     <!--   increment item[1] (= 4)  -->
  7467.     </OL>          <!--  )                         -->
  7468.   <LI>item         <!--  increment item[0] (= 3)   -->
  7469.   <LI>item         <!--  increment item[0] (= 4)   -->
  7470. </OL>              <!-- )                          -->
  7471. <OL>               <!-- (reset item[4] to 0        -->
  7472.   <LI>item         <!--  increment item[4] (= 1)   -->
  7473.   <LI>item         <!--  increment item[4] (= 2)   -->
  7474. </OL>              <!-- )                          -->
  7475.  
  7476. The 'counters()' function generates a string composed of the values of all
  7477. counters with the same name, separated by a given string.
  7478.  
  7479. Example(s):
  7480.  
  7481. The following style sheet numbers nested list items as "1", "1.1", "1.1.1",
  7482. etc.
  7483.  
  7484. OL { counter-reset: item }
  7485. LI { display: block }
  7486. LI:before { content: counters(item, "."); counter-increment: item }
  7487.  
  7488. 12.5.2 Counter styles
  7489.  
  7490. By default, counters are formatted with decimal numbers, but all the styles
  7491. available for the 'list-style-type' property are also available for
  7492. counters. The notation is:
  7493.  
  7494. counter(name)
  7495.  
  7496. for the default style, or:
  7497.  
  7498. counter(name, 'list-style-type')
  7499.  
  7500. All the styles are allowed, including 'disc', 'circle', 'square', and
  7501. 'none'.
  7502.  
  7503. Example(s):
  7504.  
  7505. H1:before        { content: counter(chno, upper-latin) ". " }
  7506. H2:before        { content: counter(section, upper-roman) " - " }
  7507. BLOCKQUOTE:after { content: " [" counter(bq, hebrew) "]" }
  7508. DIV.note:before  { content: counter(notecntr, disc) " " }
  7509. P:before         { content: counter(p, none) }
  7510.  
  7511. 12.5.3 Counters in elements with 'display: none'
  7512.  
  7513. An element that is not displayed ('display' set to 'none') cannot increment
  7514. or reset a counter.
  7515.  
  7516. Example(s):
  7517.  
  7518. For example, with the following style sheet, H2s with class "secret" do not
  7519. increment 'count2'.
  7520.  
  7521. H2.secret {counter-increment: count2; display: none}
  7522.  
  7523. Elements with 'visibility' set to 'hidden', on the other hand, do increment
  7524. counters.
  7525.  
  7526. 12.6 Markers and lists
  7527.  
  7528. Most block-level elements in CSS generate one principal block box. In this
  7529. section, we discuss two CSS mechanisms that cause an element to generate two
  7530. boxes: one principal block box (for the element's content) and one separate
  7531. marker box (for decoration such as a bullet, image, or number). The marker
  7532. box may be positioned inside or outside the principal box. Unlike :before
  7533. and :after content, the marker box does not affect the position of the
  7534. principal box, whatever the positioning scheme.
  7535.  
  7536. The more general of the two mechanisms is new in CSS2 and is called markers.
  7537. The more limited mechanism involves the list properties of CSS1. The list
  7538. properties give authors quick results for many common ordered and unordered
  7539. list scenarios. However, markers give authors precise control over marker
  7540. content and position. Markers may be used with counters to create new list
  7541. styles, to number margin notes, and much more.
  7542.  
  7543. For instance, the following example illustrates how markers may be used to
  7544. add periods after each numbered list item. This HTML program and style
  7545. sheet:
  7546.  
  7547. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  7548. <HTML>
  7549.    <HEAD>
  7550.      <TITLE>Creating a list with markers</TITLE>
  7551.      <STYLE type="text/css">
  7552.           LI:before {
  7553.               display: marker;
  7554.               content: counter(mycounter, lower-roman) ".";
  7555.               counter-increment: mycounter;
  7556.           }
  7557.      </STYLE>
  7558.   </HEAD>
  7559.   <BODY>
  7560.     <OL>
  7561.       <LI> This is the first item.
  7562.       <LI> This is the second item.
  7563.       <LI> This is the third item.
  7564.     </OL>
  7565.   </BODY>
  7566. </HTML>
  7567.  
  7568. should produce something like this:
  7569.  
  7570.    i. This is the first item.
  7571.   ii. This is the second item.
  7572.  iii. This is the third item.
  7573.  
  7574. With descendant selectors and child selectors, it's possible to specify
  7575. different marker types depending on the depth of embedded lists.
  7576.  
  7577. 12.6.1 Markers: the 'marker-offset' property
  7578.  
  7579. Markers are created by setting the 'display' property to 'marker' inside a
  7580. :before or :after pseudo-element. While 'block' and 'inline' :before and
  7581. :after content is part of the principal box generated by the element,
  7582. 'marker' content is formatted in an independent marker box, outside the
  7583. principal box. Marker boxes are formatted as a single line (i.e., one line
  7584. box), so they are not as flexible as floats. The marker box is only created
  7585. if the 'content' property for the pseudo-element actually generates content.
  7586.  
  7587. Marker boxes have padding and borders, but no margins.
  7588.  
  7589. For the :before pseudo-element, the baseline of text in the marker box will
  7590. be vertically aligned with the baseline of text in the first line of content
  7591. in the principal box. If the principal box contains no text, the top outer
  7592. edge of the marker box will be aligned with the top outer edge of the
  7593. principal box. For the :after pseudo-element, the baseline of text in the
  7594. marker box will be vertically aligned with the baseline of text in the last
  7595. line of content in the principal box. If the principal box contains no text,
  7596. the bottom outer edge of the marker box will be aligned with the bottom
  7597. outer edge of the principal box.
  7598.  
  7599. The height of a marker box is given by the 'line-height' property. The
  7600. :before (:after) marker box participates in the height calculation of the
  7601. principal box's first (last) line box. Thus, markers are aligned with the
  7602. first and last line of an element's content, even though the marker boxes
  7603. live in distinct line boxes. If no first or last line box exists in a
  7604. principal box, the marker box establishes its line box alone.
  7605.  
  7606. The vertical alignment of a marker box within its line box is specified with
  7607. the 'vertical-align' property.
  7608.  
  7609. If the value of the 'width' property is 'auto', the marker box content width
  7610. is that of the content, otherwise it is the value of 'width'. For values of
  7611. 'width' less than the content width, the 'overflow' property specifies
  7612. overflow behavior. Marker boxes may overlap principal boxes. For values of
  7613. 'width' greater than the content width, the 'text-align' property determines
  7614. the horizontal alignment of the content in the marker box.
  7615.  
  7616. The 'marker-offset' property specifies the horizontal offset between a
  7617. marker box and the associated principal box. The distance is measured
  7618. between their nearest border edges. Note. If a marker flows to the right of
  7619. a float in a left-to-right formatting context, the principal box will flow
  7620. down the float's right side, but the marker boxes will appear to the left of
  7621. the float. Since the principal box left border edge lies to the left of the
  7622. float (see the description of floats), and marker boxes lie outside the
  7623. border edge of the principal box, the marker will also lie to the left of
  7624. the float. Analogous behavior applies for right-to-left formatting when a
  7625. marker flows to the left of a float.
  7626.  
  7627. When the 'display' property has the value 'marker' for content generated by
  7628. an element with 'display: list-item', a marker box generated for ':before'
  7629. replaces the normal list item marker.
  7630.  
  7631. In the following example, the content is centered within a marker box of a
  7632. fixed width. This document:
  7633.  
  7634. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  7635.  <HTML>
  7636.     <HEAD>
  7637.       <TITLE>Content alignment in the marker box</TITLE>
  7638.       <STYLE type="text/css">
  7639.            LI:before {
  7640.                display: marker;
  7641.                content: "(" counter(counter) ")";
  7642.                counter-increment: counter;
  7643.                width: 6em;
  7644.                text-align: center;
  7645.            }
  7646.       </STYLE>
  7647.    </HEAD>
  7648.    <BODY>
  7649.      <OL>
  7650.        <LI> This is the first item.
  7651.        <LI> This is the second item.
  7652.        <LI> This is the third item.
  7653.      </OL>
  7654.    </BODY>
  7655.  </HTML>
  7656.  
  7657. should produce something like this:
  7658.  
  7659.   (1)    This is the
  7660.          first item.
  7661.   (2)    This is the
  7662.          second item.
  7663.   (3)    This is the
  7664.          third item.
  7665.  
  7666. The next example creates markers before and after list items.
  7667.  
  7668. This document:
  7669.  
  7670. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  7671. <HTML>
  7672.   <HEAD>
  7673.     <TITLE>Markers before and after list items</TITLE>
  7674.     <STYLE type="text/css">
  7675.       @media screen, print {
  7676.          LI:before {
  7677.               display: marker;
  7678.               content: url("smiley.gif");
  7679.          LI:after {
  7680.               display: marker;
  7681.               content: url("sad.gif");
  7682.          }
  7683.       }
  7684.     </STYLE>
  7685.   </HEAD>
  7686.   <BODY>
  7687.     <UL>
  7688.       <LI>first list item comes first
  7689.       <LI>second list item comes second
  7690.     </UL>
  7691.   </BODY>
  7692. </HTML>
  7693.  
  7694. should produce something like this (ascii art is used instead of smiley gif
  7695. images here):
  7696.  
  7697.   :-) first list item
  7698.       comes first      :-(
  7699.   :-) second list item
  7700.       comes second     :-(
  7701.  
  7702. The next example uses markers to number notes (paragraphs).
  7703.  
  7704. The following document:
  7705.  
  7706. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  7707. <HTML>
  7708.   <HEAD>
  7709.     <TITLE>Markers to create numbered notes4>/TITLE>
  7710.     <STYLE type="text/css">
  7711.       P { margin-left: 12 em; }
  7712.       @media screen, print {
  7713.          P.Note:before         {
  7714.               display: marker;
  7715.               content: url("note.gif")
  7716.                        "Note " counter(note-counter) ":";
  7717.               counter-increment: note-counter;
  7718.               text-align: left;
  7719.               width: 10em;
  7720.          }
  7721.      }
  7722.     </STYLE>
  7723.   </HEAD>
  7724.   <BODY>
  7725.     <P>This is the first paragraph in this document.</P>
  7726.     <P CLASS="Note">This is a very short document.</P>
  7727.     <P>This is the end.</P>
  7728.   </BODY>
  7729. </HTML>
  7730.  
  7731. should produce something like:
  7732.  
  7733.             This is the first paragraph
  7734.             in this document.
  7735.  
  7736.   Note 1:   This is a very short
  7737.             document.
  7738.  
  7739.             This is the end.
  7740.  
  7741. 'marker-offset'
  7742.      Value:         <length> | auto | inherit
  7743.      Initial:       auto
  7744.      Applies to:    elements with 'display: marker'
  7745.      Inherited:     no
  7746.      Percentages:   N/A
  7747.      Media:         visual
  7748.  
  7749. This property specifies the distance between the nearest border edges of a
  7750. marker box and its associated principal box. The offset may either be a
  7751. user-specified (<length>) or chosen by the UA ('auto'). Lengths may be
  7752. negative, but there may be implementation-specific limits.
  7753.  
  7754. The following example illustrates how markers may be used to add periods
  7755. after each numbered list item. This HTML program and style sheet:
  7756.  
  7757. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  7758.  <HTML>
  7759.     <HEAD>
  7760.       <TITLE>Marker example 5</TITLE>
  7761.       <STYLE type="text/css">
  7762.            P { margin-left: 8em } /* Make space for counters */
  7763.            LI:before {
  7764.                display: marker;
  7765.                marker-offset: 3em;
  7766.                content: counter(mycounter, lower-roman) ".";
  7767.                counter-increment: mycounter;
  7768.            }
  7769.       </STYLE>
  7770.    </HEAD>
  7771.    <BODY>
  7772.      <P> This is a long preceding paragraph ...
  7773.      <OL>
  7774.        <LI> This is the first item.
  7775.        <LI> This is the second item.
  7776.        <LI> This is the third item.
  7777.      </OL>
  7778.      <P> This is a long following paragraph ...
  7779.    </BODY>
  7780.  </HTML>
  7781.  
  7782. should produce something like this:
  7783.  
  7784.         This is a long preceding
  7785.         paragraph ...
  7786.  
  7787.    i.   This is the first item.
  7788.   ii.   This is the second item.
  7789.  iii.   This is the third item.
  7790.  
  7791.         This is a long following
  7792.         paragraph ...
  7793.  
  7794. 12.6.2 Lists: the 'list-style-type', 'list-style-image',
  7795. 'list-style-position', and 'list-style' properties
  7796.  
  7797. The list properties allow basic visual formatting of lists. As with more
  7798. general markers, a element with 'display: list-item' generates a principal
  7799. box for the element's content and an optional marker box. The other list
  7800. properties allow authors to specify the marker type (image, glyph, or
  7801. number) and its position with respect to the principal box (outside it or
  7802. within it before content). They do not allow authors to specify distinct
  7803. style (colors, fonts, alignment, etc.) for the list marker or adjust its
  7804. position with respect to the principal box.
  7805.  
  7806. Furthermore, when a marker M (created with 'display: marker') is used with a
  7807. list item created by the list properties, M replaces the standard list item
  7808. marker.
  7809.  
  7810. With the list properties, the background properties apply to the principal
  7811. box only; an 'outside' marker box is transparent. Markers offer more control
  7812. over marker box style.
  7813.  
  7814. 'list-style-type'
  7815.      Value:         disc | circle | square | decimal | decimal-leading-zero
  7816.                     | lower-roman | upper-roman | lower-greek | lower-alpha
  7817.                     | lower-latin | upper-alpha | upper-latin | hebrew |
  7818.                     armenian | georgian | cjk-ideographic | hiragana |
  7819.                     katakana | hiragana-iroha | katakana-iroha | none |
  7820.                     inherit
  7821.      Initial:       disc
  7822.      Applies to:    elements with 'display: list-item'
  7823.      Inherited:     yes
  7824.      Percentages:   N/A
  7825.      Media:         visual
  7826.  
  7827. This property specifies appearance of the list item marker if
  7828. 'list-style-image' has the value 'none' or if the image pointed to by the
  7829. URI cannot be displayed. The value 'none' specifies no marker, otherwise
  7830. there are three types of marker: glyphs, numbering systems, and alphabetic
  7831. systems. Note. Numbered lists improve document accessibility by making lists
  7832. easier to navigate.
  7833.  
  7834. Glyphs are specified with disc, circle, and square. Their exact rendering
  7835. depends on the user agent.
  7836.  
  7837. Numbering systems are specified with:
  7838.  
  7839. decimal
  7840.      Decimal numbers, beginning with 1.
  7841. decimal-leading-zero
  7842.      Decimal numbers padded by initial zeros (e.g., 01, 02, 03, ..., 98,
  7843.      99).
  7844. lower-roman
  7845.      Lowercase roman numerals (i, ii, iii, iv, v, etc.).
  7846. upper-roman
  7847.      Uppercase roman numerals (I, II, III, IV, V, etc.).
  7848. hebrew
  7849.      Traditional Hebrew numbering.
  7850. georgian
  7851.      Traditional Georgian numbering (an, ban, gan, ..., he, tan, in, in-an,
  7852.      ...).
  7853. armenian
  7854.      Traditional Armenian numbering.
  7855. cjk-ideographic
  7856.      Plain ideographic numbers
  7857. hiragana
  7858.      a, i, u, e, o, ka, ki, ...
  7859. katakana
  7860.      A, I, U, E, O, KA, KI, ...
  7861. hiragana-iroha
  7862.      i, ro, ha, ni, ho, he, to, ...
  7863. katakana-iroha
  7864.      I, RO, HA, NI, HO, HE, TO, ...
  7865.  
  7866. A user agent that does not recognize a numbering system should use
  7867. 'decimal'.
  7868.  
  7869. Note. This document does not specify the exact mechanism of each numbering
  7870. system (e.g., how roman numerals are calculated). A future W3C Note may
  7871. provide further clarifications.
  7872.  
  7873. Alphabetic systems are specified with:
  7874.  
  7875. lower-latin or lower-alpha
  7876.      Lowercase ascii letters (a, b, c, ... z).
  7877. upper-latin or upper-alpha
  7878.      Uppercase ascii letters (A, B, C, ... Z).
  7879. lower-greek
  7880.      Lowercase classical Greek alpha, beta, gamma, ... (?, ?, ?, ...)
  7881.  
  7882. This specification does not define how alphabetic systems wrap at the end of
  7883. the alphabet. For instance, after 26 list items, 'lower-latin' rendering is
  7884. undefined. Therefore, for long lists, we recommend that authors specify true
  7885. numbers.
  7886.  
  7887. For example, the following HTML document:
  7888.  
  7889. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  7890. <HTML>
  7891.    <HEAD>
  7892.      <TITLE>Lowercase latin numbering</TITLE>
  7893.      <STYLE type="text/css">
  7894.           OL { list-style-type: lower-roman }
  7895.      </STYLE>
  7896.   </HEAD>
  7897.   <BODY>
  7898.     <OL>
  7899.       <LI> This is the first item.
  7900.       <LI> This is the second item.
  7901.       <LI> This is the third item.
  7902.     </OL>
  7903.   </BODY>
  7904. </HTML>
  7905.  
  7906. might produce something like this:
  7907.  
  7908.   i This is the first item.
  7909.  ii This is the second item.
  7910. iii This is the third item.
  7911.  
  7912. Note that the list marker alignment (here, right justified) depends on the
  7913. user agent.
  7914.  
  7915. Note. Future versions of CSS may provide more complete mechanisms for
  7916. international numbering styles.
  7917.  
  7918. 'list-style-image'
  7919.      Value:         <uri> | none | inherit
  7920.      Initial:       none
  7921.      Applies to:    elements with 'display: list-item'
  7922.      Inherited:     yes
  7923.      Percentages:   N/A
  7924.      Media:         visual
  7925.  
  7926. This property sets the image that will be used as the list item marker. When
  7927. the image is available, it will replace the marker set with the
  7928. 'list-style-type' marker.
  7929.  
  7930. Example(s):
  7931.  
  7932. The following example sets the marker at the beginning of each list item to
  7933. be the image "ellipse.png".
  7934.  
  7935. UL { list-style-image: url("http://png.com/ellipse.png") }
  7936.  
  7937. 'list-style-position'
  7938.      Value:         inside | outside | inherit
  7939.      Initial:       outside
  7940.      Applies to:    elements with 'display: list-item'
  7941.      Inherited:     yes
  7942.      Percentages:   N/A
  7943.      Media:         visual
  7944.  
  7945. This property specifies the position of the marker box in the principal
  7946. block box. Values have the following meanings:
  7947.  
  7948. outside
  7949.      The marker box is outside the principal block box. Note. CSS1 did not
  7950.      specify the precise location of the marker box and for reasons of
  7951.      compatibility, CSS2 remains equally ambiguous. For more precise control
  7952.      of marker boxes, please use markers.
  7953. inside
  7954.      The marker box is the first inline box in the principal block box,
  7955.      after which the element's content flows.
  7956.  
  7957. For example:
  7958.  
  7959. <HTML>
  7960.   <HEAD>
  7961.     <TITLE>Comparison of inside/outside position</TITLE>
  7962.     <STYLE type="text/css">
  7963.       UL         { list-style: outside }
  7964.       UL.compact { list-style: inside }
  7965.     </STYLE>
  7966.   </HEAD>
  7967.   <BODY>
  7968.     <UL>
  7969.       <LI>first list item comes first
  7970.       <LI>second list item comes second
  7971.     </UL>
  7972.  
  7973.     <UL class="compact">
  7974.       <LI>first list item comes first
  7975.       <LI>second list item comes second
  7976.     </UL>
  7977.   </BODY>
  7978. </HTML>
  7979.  
  7980. The above example may be formatted as:
  7981.  
  7982. [Difference between insideand outside list style position]   [D]
  7983.  
  7984. In right-to-left text, the markers would have been on the right side of the
  7985. box.
  7986.  
  7987. 'list-style'
  7988.      Value:         [ <'list-style-type'> || <'list-style-position'> ||
  7989.                     <'list-style-image'> ] | inherit
  7990.      Initial:       not defined for shorthand properties
  7991.      Applies to:    elements with 'display: list-item'
  7992.      Inherited:     yes
  7993.      Percentages:   N/A
  7994.      Media:         visual
  7995.  
  7996. The 'list-style' property is a shorthand notation for setting the three
  7997. properties 'list-style-type', 'list-style-image', and 'list-style-position'
  7998. at the same place in the style sheet.
  7999.  
  8000. Example(s):
  8001.  
  8002. UL { list-style: upper-roman inside }  /* Any UL */
  8003. UL > UL { list-style: circle outside } /* Any UL child of a UL */
  8004.  
  8005. Although authors may specify 'list-style' information directly on list item
  8006. elements (e.g., LI in HTML), they should do so with care. The following
  8007. rules look similar, but the first declares a descendant selector and the
  8008. second a (more specific) child selector.
  8009.  
  8010. OL.alpha LI   { list-style: lower-alpha } /* Any LI descendant of an OL */
  8011. OL.alpha > LI { list-style: lower-alpha } /* Any LI child of an OL */
  8012.  
  8013. Authors who use only the descendant selector may not achieve the results
  8014. they expect. Consider the following rules:
  8015.  
  8016. <HTML>
  8017.   <HEAD>
  8018.     <TITLE>WARNING: Unexpected results due to cascade</TITLE>
  8019.     <STYLE type="text/css">
  8020.       OL.alpha LI  { list-style: lower-alpha }
  8021.       UL LI        { list-style: disc }
  8022.     </STYLE>
  8023.   </HEAD>
  8024.   <BODY>
  8025.     <OL class="alpha">
  8026.       <LI>level 1
  8027.       <UL>
  8028.          <LI>level 2
  8029.       </UL>
  8030.     </OL>
  8031.   </BODY>
  8032. </HTML>
  8033.  
  8034. The desired rendering would have level 1 list items with 'lower-alpha'
  8035. labels and level 2 items with 'disc' labels. However, the cascading order
  8036. will cause the first style rule (which includes specific class information)
  8037. to mask the second. The following rules solve the problem by employing a
  8038. child selector instead:
  8039.  
  8040. OL.alpha > LI  { list-style: lower-alpha }
  8041. UL LI   { list-style: disc }
  8042.  
  8043. Another solution would be to specify 'list-style' information only on the
  8044. list type elements:
  8045.  
  8046. OL.alpha  { list-style: lower-alpha }
  8047. UL        { list-style: disc }
  8048.  
  8049. Inheritance will transfer the 'list-style' values from OL and UL elements to
  8050. LI elements. This is the recommended way to specify list style information.
  8051.  
  8052. Example(s):
  8053.  
  8054. A URI value may be combined with any other value, as in:
  8055.  
  8056. UL { list-style: url("http://png.com/ellipse.png") disc }
  8057.  
  8058. In the example above, the 'disc' will be used when the image is unavailable.
  8059.  
  8060. A value of 'none' for the 'list-style' property sets both 'list-style-type'
  8061. and 'list-style-image' to 'none':
  8062.  
  8063. UL { list-style: none }
  8064.  
  8065. The result is that no list-item marker is displayed.
  8066.   ------------------------------------------------------------------------
  8067.   ------------------------------------------------------------------------
  8068.  
  8069.                                13 Paged media
  8070.  
  8071. Contents
  8072.  
  8073.    * 13.1 Introduction to paged media
  8074.    * 13.2 Page boxes: the @page rule
  8075.         o 13.2.1 Page margins
  8076.         o 13.2.2 Page size: the 'size' property
  8077.              + Rendering page boxes that do not fit a target sheet
  8078.              + Positioning the page box on the sheet
  8079.         o 13.2.3 Crop marks: the 'marks' property
  8080.         o 13.2.4 Left, right, and first pages
  8081.         o 13.2.5 Content outside the page box
  8082.    * 13.3 Page breaks
  8083.         o 13.3.1 Break before/after elements: 'page-break-before',
  8084.           'page-break-after', 'page-break-inside'
  8085.         o 13.3.2 Using named pages: 'page'
  8086.         o 13.3.3 Breaks inside elements: 'orphans', 'widows'
  8087.         o 13.3.4 Allowed page breaks
  8088.         o 13.3.5 Forced page breaks
  8089.         o 13.3.6 "Best" page breaks
  8090.    * 13.4 Cascading in the page context
  8091.  
  8092. 13.1 Introduction to paged media
  8093.  
  8094. Paged media (e.g., paper, transparencies, pages that are displayed on
  8095. computer screens, etc.) differ from continuous media in that the content of
  8096. the document is split into one or more discrete pages. To handle page
  8097. breaks, CSS2 extends the visual formatting model as follows:
  8098.  
  8099.   1. The page box extends the box model to allow authors to specify the size
  8100.      of a page, its margins, etc.
  8101.   2. The page model extends the visual formatting model to account for page
  8102.      breaks.
  8103.  
  8104. The CSS2 page model specifies how a document is formatted within a
  8105. rectangular area -- the page box -- that has a finite width and height. The
  8106. page box does not necessarily correspond to the real sheet where the
  8107. document will ultimately be rendered (paper, transparency, screen, etc.).
  8108. The CSS page model specifies formatting in the page box, but it is the user
  8109. agent's responsibility to transfer the page box to the sheet. Some transfer
  8110. possibilities include:
  8111.  
  8112.    * Transferring one page box to one sheet (e.g., single-sided printing).
  8113.    * Transferring two page boxes to both sides of the same sheet (e.g.,
  8114.      double-sided printing).
  8115.    * Transferring N (small) page boxes to one sheet (called "n-up").
  8116.    * Transferring one (large) page box to N x M sheets (called "tiling").
  8117.    * Creating signatures. A signature is a group of pages printed on a
  8118.      sheet, which, when folded and trimmed like a book, appear in their
  8119.      proper sequence.
  8120.    * Printing one document to several output trays.
  8121.    * Outputting to a file.
  8122.  
  8123. Although CSS2 does not specify how user agents transfer page boxes to
  8124. sheets, it does include certain mechanisms for telling user agents about the
  8125. target sheet size and orientation.
  8126.  
  8127. 13.2 Page boxes: the @page rule
  8128.  
  8129. The page box is a rectangular region that contains two areas:
  8130.  
  8131.    * The page area. The page area includes the boxes laid out on that page.
  8132.      The edges of the page area act as the initial containing block for
  8133.      layout that occurs between page breaks.
  8134.    * The margin area, which surrounds the page area.
  8135.  
  8136. Note. In CSS2, the border properties and padding properties do not apply to
  8137. pages; they may in the future.
  8138.  
  8139. Authors specify the dimensions, orientation, margins, etc. of a page box
  8140. within an @page rule. An @page rule consists of the keyword "@page", a page
  8141. selector (followed with no intervening space by an optional page
  8142. pseudo-class), and a block of declarations (said to be in the page context).
  8143.  
  8144. The page selector specifies for which pages the declarations apply. In CSS2,
  8145. page selectors may designate the first page, all left pages, all right
  8146. pages, or a page with a specific name.
  8147.  
  8148. The dimensions of the page box are set with the 'size' property. The
  8149. dimensions of the page area are the dimensions of the page box minus the
  8150. margin area.
  8151.  
  8152. Example(s):
  8153.  
  8154. For example, the following @page rule sets the page box size to 8.5 x 11
  8155. inches and creates '2cm' margin on all sides between the page box edge and
  8156. the page area:
  8157.  
  8158. @page { size 8.5in 11in; margin: 2cm }
  8159.  
  8160. The 'marks' property in an @page rule specifies crop and cross marks for the
  8161. page box.
  8162.  
  8163. 13.2.1 Page margins
  8164.  
  8165. The margin properties ('margin-top', 'margin-right', 'margin-bottom',
  8166. 'margin-left', and 'margin') apply within the page context. The following
  8167. diagram shows the relationships between the sheet, page box, and page
  8168. margins:
  8169.  
  8170. [Illustration of sheet, pagebox, margin, and page area.]   [D]
  8171.  
  8172. The computed value of box margins at the top or bottom of the page area is
  8173. '0'.
  8174.  
  8175. The page context has no notion of fonts, so 'em' and 'ex' units are not
  8176. allowed. Percentage values on the margin properties are relative to the
  8177. dimensions of the page box; for left and right margins, they refer to page
  8178. box width while for top and bottom margins, they refer to page box height.
  8179. All other units associated with the respective CSS2 properties are allowed.
  8180.  
  8181. Due to negative margin values (either on the page box or on elements) or
  8182. absolute positioning content may end up outside the page box, but this
  8183. content may be "cut" -- by the user agent, the printer, or ultimately, the
  8184. paper cutter.
  8185.  
  8186. 13.2.2 Page size: the 'size' property
  8187.  
  8188. 'size'
  8189.      Value:         <length>{1,2} | auto | portrait | landscape | inherit
  8190.      Initial:       auto
  8191.      Applies to:    the page context
  8192.      Inherited:     N/A
  8193.      Percentages:   N/A
  8194.      Media:         visual, paged
  8195.  
  8196. This property specifies the size and orientation of a page box.
  8197.  
  8198. The size of a page box may either be "absolute" (fixed size) or "relative"
  8199. (scalable, i.e., fitting available sheet sizes). Relative page boxes allow
  8200. user agents to scale a document and make optimal use of the target size.
  8201.  
  8202. Three values for the 'size' property create a relative page box:
  8203.  
  8204. auto
  8205.      The page box will be set to the size and orientation of the target
  8206.      sheet.
  8207. landscape
  8208.      Overrides the target's orientation. The page box is the same size as
  8209.      the target, and the longer sides are horizontal.
  8210. portrait
  8211.      Overrides the target's orientation. The page box is the same size as
  8212.      the target, and the shorter sides are horizontal.
  8213.  
  8214. Example(s):
  8215.  
  8216. In the following example, the outer edges of the page box will align with
  8217. the target. The percentage value on the 'margin' property is relative to the
  8218. target size so if the target sheet dimensions are 21.0cm x 29.7cm (i.e.,
  8219. A4), the margins are 2.10cm and 2.97cm.
  8220.  
  8221. @page {
  8222.   size: auto;   /* auto is the initial value */
  8223.   margin: 10%;
  8224. }
  8225.  
  8226. Length values for the 'size' property create an absolute page box. If only
  8227. one length value is specified, it sets both the width and height of the page
  8228. box (i.e., the box is a square). Since the page box is the initial
  8229. containing block, percentage values are not allowed for the 'size' property.
  8230.  
  8231. Example(s):
  8232.  
  8233. For example:
  8234.  
  8235. @page {
  8236.   size: 8.5in 11in;  /* width height */
  8237. }
  8238.  
  8239. The above example set the width of the page box to be 8.5in and the height
  8240. to be 11in. The page box in this example requires a target sheet size of
  8241. 8.5"x11" or larger.
  8242.  
  8243. User agents may allow users to control the transfer of the page box to the
  8244. sheet (e.g., rotating an absolute page box that's being printed).
  8245.  
  8246. Rendering page boxes that do not fit a target sheet
  8247.  
  8248. If a page box does not fit the target sheet dimensions, the user agent may
  8249. choose to:
  8250.  
  8251.    * Rotate the page box 90∞ if this will make the page box fit.
  8252.    * Scale the page to fit the target.
  8253.  
  8254. The user agent should consult the user before performing these operations.
  8255.  
  8256. Positioning the page box on the sheet
  8257.  
  8258. When the page box is smaller than the target size, the user agent is free to
  8259. place the page box anywhere on the sheet. However, it is recommended that
  8260. the page box be centered on the sheet since this will align double-sided
  8261. pages and avoid accidental loss of information that is printed near the edge
  8262. of the sheet.
  8263.  
  8264. 13.2.3 Crop marks: the 'marks' property
  8265.  
  8266. 'marks'
  8267.      Value:         [ crop || cross ] | none | inherit
  8268.      Initial:       none
  8269.      Applies to:    page context
  8270.      Inherited:     N/A
  8271.      Percentages:   N/A
  8272.      Media:         visual, paged
  8273.  
  8274. In high-quality printing, marks are often added outside the page box. This
  8275. property specifies whether cross marks or crop marks or both should be
  8276. rendered just outside the page box edge.
  8277.  
  8278. Crop marks indicate where the page should be cut. Cross marks (also known as
  8279. register marks or registration marks) are used to align sheets.
  8280.  
  8281. Marks are visible only on absolute page boxes (see the 'size' property). In
  8282. relative page boxes, the page box will be aligned with the target and the
  8283. marks will be outside the printable area.
  8284.  
  8285. The size, style, and position of cross marks depend on the user agent.
  8286.  
  8287. 13.2.4 Left, right, and first pages
  8288.  
  8289. When printing double-sided documents, the page boxes on left and right pages
  8290. should be different. This can be expressed through two CSS pseudo-classes
  8291. that may be defined in the page context.
  8292.  
  8293. All pages are automatically classified by user agents into either the :left
  8294. or :right pseudo-class.
  8295.  
  8296. Example(s):
  8297.  
  8298. @page :left {
  8299.   margin-left: 4cm;
  8300.   margin-right: 3cm;
  8301. }
  8302.  
  8303. @page :right {
  8304.   margin-left: 3cm;
  8305.   margin-right: 4cm;
  8306. }
  8307.  
  8308. If different declarations have been given for left and right pages, the user
  8309. agent must honor these declarations even if the user agent does not transfer
  8310. the page boxes to left and right sheets (e.g., a printer that only prints
  8311. single-sided).
  8312.  
  8313. Authors may also specify style for the first page of a document with the
  8314. :first pseudo-class:
  8315.  
  8316. Example(s):
  8317.  
  8318. @page { margin: 2cm } /* All margins set to 2cm */
  8319.  
  8320. @page :first {
  8321.   margin-top: 10cm    /* Top margin on first page 10cm */
  8322. }
  8323.  
  8324. Whether the first page of a document is :left or :right depends on the major
  8325. writing direction of the document and is outside the scope of this document.
  8326. However, to force a :left or :right first page, authors may insert a page
  8327. break before the first generated box (e.g., in HTML, specify this for the
  8328. BODY element).
  8329.  
  8330. Properties specified in a :left (or :right) @page rule override those
  8331. specified in an @page rule that has no pseudo-class specified. Properties
  8332. specified in a :first @page rule override those specified in :left (or
  8333. :right) @page rules.
  8334.  
  8335. Note. Adding declarations to the :left or :right pseudo-class does not
  8336. influence whether the document comes out of the printer double- or
  8337. single-sided (which is outside the scope of this specification).
  8338.  
  8339. Note. Future versions of CSS may include other page pseudo-classes.
  8340.  
  8341. 13.2.5 Content outside the page box
  8342.  
  8343. When formatting content in the page model, some content may end up outside
  8344. the page box. For example, an element whose 'white-space' property has the
  8345. value 'pre' may generate a box that is wider than the page box. Also, when
  8346. boxes are positioned absolutely, they may end up in "inconvenient"
  8347. locations. For example, images may be placed on the edge of the page box or
  8348. 100,000 inches below the page box.
  8349.  
  8350. A specification for the exact formatting of such elements lies outside the
  8351. scope of this document. However, we recommend that authors and user agents
  8352. observe the following general principles concerning content outside the page
  8353. box:
  8354.  
  8355.    * Content should be allowed slightly beyond the page box to allow pages
  8356.      to "bleed".
  8357.    * User agents should avoid generating a large number of empty page boxes
  8358.      to honor the positioning of elements (e.g., you don't want to print 100
  8359.      blank pages). Note, however, that generating a small number of empty
  8360.      page boxes may be necessary to honor the 'left' and 'right' values for
  8361.      'page-break-before' and 'page-break-after'.
  8362.    * Authors should not position elements in inconvenient locations just to
  8363.      avoid rendering them. Instead:
  8364.         o To suppress box generation entirely, set the 'display' property to
  8365.           'none'.
  8366.         o To make a box invisible, use the 'visibility' property.
  8367.    * User agents may handle boxes positioned outside the page box in several
  8368.      ways, including discarding them or creating page boxes for them at the
  8369.      end of the document.
  8370.  
  8371. 13.3 Page breaks
  8372.  
  8373. The following sections explain page formatting in CSS2. Five properties
  8374. indicate where the user agent may or should break pages, and on what page
  8375. (left or right) the subsequent content should resume. Each page break ends
  8376. layout in the current page box and causes remaining pieces of the document
  8377. tree to be laid out in a new page box.
  8378.  
  8379. 13.3.1 Break before/after elements: 'page-break-before', 'page-break-after',
  8380. 'page-break-inside'
  8381.  
  8382. 'page-break-before'
  8383.      Value:         auto | always | avoid | left | right | inherit
  8384.      Initial:       auto
  8385.      Applies to:    block-level elements
  8386.      Inherited:     no
  8387.      Percentages:   N/A
  8388.      Media:         visual, paged
  8389.  
  8390. 'page-break-after'
  8391.      Value:         auto | always | avoid | left | right | inherit
  8392.      Initial:       auto
  8393.      Applies to:    block-level elements
  8394.      Inherited:     no
  8395.      Percentages:   N/A
  8396.      Media:         visual, paged
  8397.  
  8398. 'page-break-inside'
  8399.      Value:         avoid | auto | inherit
  8400.      Initial:       auto
  8401.      Applies to:    block-level elements
  8402.      Inherited:     yes
  8403.      Percentages:   N/A
  8404.      Media:         visual, paged
  8405.  
  8406. Values for these properties have the following meanings:
  8407.  
  8408. auto
  8409.      Neither force nor forbid a page break before (after, inside) the
  8410.      generated box.
  8411. always
  8412.      Always force a page break before (after) the generated box.
  8413. avoid
  8414.      Avoid a page break before (after, inside) the generated box.
  8415. left
  8416.      Force one or two page breaks before (after) the generated box so that
  8417.      the next page is formatted as a left page.
  8418. right
  8419.      Force one or two page breaks before (after) the generated box so that
  8420.      the next page is formatted as a right page.
  8421.  
  8422. A potential page break location is typically under the influence of the
  8423. parent element's 'page-break-inside' property, the 'page-break-after'
  8424. property of the preceding element, and the 'page-break-before' property of
  8425. the following element. When these properties have values other than 'auto',
  8426. the values 'always', 'left', and 'right' take precedence over 'avoid'. See
  8427. the section on allowed page breaks for the exact rules on how these
  8428. properties may force or suppress a page break.
  8429.  
  8430. 13.3.2 Using named pages: 'page'
  8431.  
  8432. 'page'
  8433.      Value:         <identifier> | auto
  8434.      Initial:       auto
  8435.      Applies to:    block-level elements
  8436.      Inherited:     yes
  8437.      Percentages:   N/A
  8438.      Media:         visual, paged
  8439.  
  8440. The 'page' property can be used to specify a particular type of page where
  8441. an element should be displayed.
  8442.  
  8443. Example(s):
  8444.  
  8445. This example will put all tables on a right-hand side landscape page (named
  8446. "rotated"):
  8447.  
  8448. @page rotated {size: landscape}
  8449. TABLE {page: rotated; page-break-before: right}
  8450.  
  8451. The 'page' property works as follows: If a block box with inline content has
  8452. a 'page' property that is different from the preceding block box with inline
  8453. content, then one or two page breaks are inserted between them, and the
  8454. boxes after the break are rendered on a page box of the named type. See
  8455. "Forced page breaks" below.
  8456.  
  8457. Example(s):
  8458.  
  8459. In this example, the two tables are rendered on landscape pages (indeed, on
  8460. the same page, if they fit), and the page type "narrow" is not used at all,
  8461. despite having been set on the DIV:
  8462.  
  8463. @page narrow {size: 9cm 18cm}
  8464. @page rotated {size: landscape}
  8465. DIV {page: narrow}
  8466. TABLE {page: rotated}
  8467.  
  8468. with this document::
  8469.  
  8470. <DIV>
  8471. <TABLE>...</TABLE>
  8472. <TABLE>...</TABLE>
  8473. </DIV>
  8474.  
  8475. 13.3.3 Breaks inside elements: 'orphans', 'widows'
  8476.  
  8477. 'orphans'
  8478.      Value:         <integer> | inherit
  8479.      Initial:       2
  8480.      Applies to:    block-level elements
  8481.      Inherited:     yes
  8482.      Percentages:   N/A
  8483.      Media:         visual, paged
  8484.  
  8485. 'widows'
  8486.      Value:         <integer> | inherit
  8487.      Initial:       2
  8488.      Applies to:    block-level elements
  8489.      Inherited:     yes
  8490.      Percentages:   N/A
  8491.      Media:         visual, paged
  8492.  
  8493. The 'orphans' property specifies the minimum number of lines of a paragraph
  8494. that must be left at the bottom of a page. The 'widows' property specifies
  8495. the minimum number of lines of a paragraph that must be left at the top of a
  8496. page. Examples of how they are used to control page breaks are given below.
  8497.  
  8498. For information about paragraph formatting, please consult the section on
  8499. line boxes.
  8500.  
  8501. 13.3.4 Allowed page breaks
  8502.  
  8503. In the normal flow, page breaks can occur at the following places:
  8504.  
  8505.   1. In the vertical margin between block boxes. When a page break occurs
  8506.      here, the computed values of the relevant 'margin-top' and
  8507.      'margin-bottom' properties are set to '0'.
  8508.   2. Between line boxes inside a block box.
  8509.  
  8510. These breaks are subject to the following rules:
  8511.  
  8512.    * Rule A: Breaking at (1) is allowed only if the 'page-break-after' and
  8513.      'page-break-before' properties of all the elements generating boxes
  8514.      that meet at this margin allow it, which is when at least one of them
  8515.      has the value 'always', 'left', or 'right', or when all of them are
  8516.      'auto'.
  8517.    * Rule B: However, if all of them are 'auto' and the nearest common
  8518.      ancestor of all the elements has a 'page-break-inside' value of
  8519.      'avoid', then breaking here is not allowed.
  8520.    * Rule C: Breaking at (2) is allowed only if the number of line boxes
  8521.      between the break and the start of the enclosing block box is the value
  8522.      of 'orphans' or more, and the number of line boxes between the break
  8523.      and the end of the box is the value of 'widows' or more.
  8524.    * Rule D: In addition, breaking at (2) is allowed only if the
  8525.      'page-break-inside' property is 'auto'.
  8526.  
  8527. If the above doesn't provide enough break points to keep content from
  8528. overflowing the page boxes, then rules B and D are dropped in order to find
  8529. additional breakpoints.
  8530.  
  8531. If that still does not lead to sufficient break points, rules A and C are
  8532. dropped as well, to find still more break points.
  8533.  
  8534. Page breaks cannot occur inside boxes that are absolutely positioned.
  8535.  
  8536. 13.3.5 Forced page breaks
  8537.  
  8538. A page break must occur at (1) if, among the 'page-break-after' and
  8539. 'page-break-before' properties of all the elements generating boxes that
  8540. meet at this margin, there is at least one with the value 'always', 'left',
  8541. or 'right'.
  8542.  
  8543. A page break must also occur at (1) if the last line box above this margin
  8544. and the first one below it do not have the same value for 'page'.
  8545.  
  8546. 13.3.6 "Best" page breaks
  8547.  
  8548. CSS2 does not define which of a set of allowed page breaks must be used;
  8549. CSS2 does not forbid a user agent from breaking at every possible break
  8550. point, or not to break at all. But CSS2 does recommend that user agents
  8551. observe the following heuristics (while recognizing that they are sometimes
  8552. contradictory):
  8553.  
  8554.    * Break as few times as possible.
  8555.    * Make all pages that don't end with a forced break appear to have about
  8556.      the same height.
  8557.    * Avoid breaking inside a block that has a border.
  8558.    * Avoid breaking inside a table.
  8559.    * Avoid breaking inside a floated element
  8560.  
  8561. Example(s):
  8562.  
  8563. Suppose, for example, that the style sheet contains 'orphans : 4', 'widows :
  8564. 2', and there are 20 lines (line boxes) available at the bottom of the
  8565. current page:
  8566.  
  8567.    * If a paragraph at the end of the current page contains 20 lines or
  8568.      fewer, it should be placed on the current page.
  8569.    * If the paragraph contains 21 or 22 lines, the second part of the
  8570.      paragraph must not violate the 'widows' constraint, and so the second
  8571.      part must contain exactly two lines
  8572.    * If the paragraph contains 23 lines or more, the first part should
  8573.      contain 20 lines and the second part the remaining lines.
  8574.  
  8575. Now suppose that 'orphans' is '10', 'widows' is '20', and there are 8 lines
  8576. available at the bottom of the current page:
  8577.  
  8578.    * If a paragraph at the end of the current page contains 8 lines or
  8579.      fewer, it should be placed on the current page.
  8580.    * If the paragraph contains 9 lines or more, it cannot be split (that
  8581.      would violate the orphan constraint), so it should move as a block to
  8582.      the next page.
  8583.  
  8584. 13.4 Cascading in the page context
  8585.  
  8586. Declarations in the page context obey the cascade just like normal CSS2
  8587. declarations.
  8588.  
  8589. Example(s):
  8590.  
  8591. Consider the following example:
  8592.  
  8593. @page {
  8594.   margin-left: 3cm;
  8595. }
  8596.  
  8597. @page :left {
  8598.   margin-left: 4cm;
  8599. }
  8600.  
  8601. Due to the higher specificity of the pseudo-class selector, the left margin
  8602. on left pages will be '4cm' and all other pages (i.e., the right pages) will
  8603. have a left margin of '3cm'.
  8604.   ------------------------------------------------------------------------
  8605.   ------------------------------------------------------------------------
  8606.  
  8607.                           14 Colors and Backgrounds
  8608.  
  8609. Contents
  8610.  
  8611.    * 14.1 Foreground color: the 'color' property
  8612.    * 14.2 The background
  8613.         o 14.2.1 Background properties: 'background-color',
  8614.           'background-image', 'background-repeat', 'background-attachment',
  8615.           'background-position', and 'background'
  8616.    * 14.3 Gamma correction
  8617.  
  8618. CSS properties allow authors to specify the foreground color and background
  8619. of an element. Backgrounds may be colors or images. Background properties
  8620. allow authors to position a background image, repeat it, and declare whether
  8621. it should be fixed with respect to the viewport or scrolled along with the
  8622. document.
  8623.  
  8624. See the section on color units for the syntax of valid color values.
  8625.  
  8626. 14.1 Foreground color: the 'color' property
  8627.  
  8628. 'color'
  8629.      Value:         <color> | inherit
  8630.      Initial:       depends on user agent
  8631.      Applies to:    all elements
  8632.      Inherited:     yes
  8633.      Percentages:   N/A
  8634.      Media:         visual
  8635.  
  8636. This property describes the foreground color of an element's text content.
  8637. There are different ways to specify red:
  8638.  
  8639. Example(s):
  8640.  
  8641. EM { color: red }              /* predefined color name */
  8642. EM { color: rgb(255,0,0) }     /* RGB range 0-255   */
  8643.  
  8644. 14.2 The background
  8645.  
  8646. Authors may specify the background of an element (i.e., its rendering
  8647. surface) as either a color or an image. In terms of the box model,
  8648. "background" refers to the background of the content and the padding areas.
  8649. Border colors and styles are set with the border properties. Margins are
  8650. always transparent so the background of the parent box always shines
  8651. through.
  8652.  
  8653. Background properties are not inherited, but the parent box's background
  8654. will shine through by default because of the initial 'transparent' value on
  8655. 'background-color'.
  8656.  
  8657. The background of the box generated by the root element covers the entire
  8658. canvas.
  8659.  
  8660. For HTML documents, however, we recommend that authors specify the
  8661. background for the BODY element rather than the HTML element. User agents
  8662. should observe the following precedence rules to fill in the background: if
  8663. the value of the 'background' property for the HTML element is different
  8664. from 'transparent' then use it, else use the value of the 'background'
  8665. property for the BODY element. If the resulting value is 'transparent', the
  8666. rendering is undefined.
  8667.  
  8668. According to these rules, the canvas underlying the following HTML document
  8669. will have a "marble" background:
  8670.  
  8671. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  8672. <HTML>
  8673.   <HEAD>
  8674.     <TITLE>Setting the canvas background</TITLE>
  8675.     <STYLE type="text/css">
  8676.        BODY { background: url("http://style.com/marble.png") }
  8677.     </STYLE>
  8678.   </HEAD>
  8679.   <BODY>
  8680.     <P>My background is marble.
  8681.   </BODY>
  8682. </HTML>
  8683.  
  8684. 14.2.1 Background properties: 'background-color', 'background-image',
  8685. 'background-repeat', 'background-attachment', 'background-position', and
  8686. 'background'
  8687.  
  8688. 'background-color'
  8689.      Value:         <color> | transparent | inherit
  8690.      Initial:       transparent
  8691.      Applies to:    all elements
  8692.      Inherited:     no
  8693.      Percentages:   N/A
  8694.      Media:         visual
  8695.  
  8696. This property sets the background color of an element, either a <color>
  8697. value or the keyword 'transparent', to make the underlying colors shine
  8698. through.
  8699.  
  8700. Example(s):
  8701.  
  8702. H1 { background-color: #F00 }
  8703.  
  8704. 'background-image'
  8705.      Value:         <uri> | none | inherit
  8706.      Initial:       none
  8707.      Applies to:    all elements
  8708.      Inherited:     no
  8709.      Percentages:   N/A
  8710.      Media:         visual
  8711.  
  8712. This property sets the background image of an element. When setting a
  8713. background image, authors should also specify a background color that will
  8714. be used when the image is unavailable. When the image is available, it is
  8715. rendered on top of the background color. (Thus, the color is visible in the
  8716. transparent parts of the image).
  8717.  
  8718. Values for this property are either <uri>, to specify the image, or 'none',
  8719. when no image is used.
  8720.  
  8721. Example(s):
  8722.  
  8723. BODY { background-image: url("marble.gif") }
  8724. P { background-image: none }
  8725.  
  8726. 'background-repeat'
  8727.      Value:         repeat | repeat-x | repeat-y | no-repeat | inherit
  8728.      Initial:       repeat
  8729.      Applies to:    all elements
  8730.      Inherited:     no
  8731.      Percentages:   N/A
  8732.      Media:         visual
  8733.  
  8734. If a background image is specified, this property specifies whether the
  8735. image is repeated (tiled), and how. All tiling covers the content and
  8736. padding areas of a box. Values have the following meanings:
  8737.  
  8738. repeat
  8739.      The image is repeated both horizontally and vertically.
  8740. repeat-x
  8741.      The image is repeated horizontally only.
  8742. repeat-y
  8743.      The image is repeated vertically only.
  8744. no-repeat
  8745.      The image is not repeated: only one copy of the image is drawn.
  8746.  
  8747. Example(s):
  8748.  
  8749. BODY {
  8750.   background: white url("pendant.gif");
  8751.   background-repeat: repeat-y;
  8752.   background-position: center;
  8753. }
  8754.  
  8755. [A centered background image,with copies repeated up and down the padding and content areas.]   [D]
  8756.  
  8757. One copy of the background image is centered, and other copies are put above
  8758. and below it to make a vertical band behind the element.
  8759.  
  8760. 'background-attachment'
  8761.      Value:         scroll | fixed | inherit
  8762.      Initial:       scroll
  8763.      Applies to:    all elements
  8764.      Inherited:     no
  8765.      Percentages:   N/A
  8766.      Media:         visual
  8767.  
  8768. If a background image is specified, this property specifies whether it is
  8769. fixed with regard to the viewport ('fixed') or scrolls along with the
  8770. document ('scroll').
  8771.  
  8772. Even if the image is fixed, it is still only visible when it is in the
  8773. background or padding area of the element. Thus, unless the image is tiled
  8774. ('background-repeat: repeat'), it may be invisible.
  8775.  
  8776. Example(s):
  8777.  
  8778. This example creates an infinite vertical band that remains "glued" to the
  8779. viewport when the element is scrolled.
  8780.  
  8781. BODY {
  8782.   background: red url("pendant.gif");
  8783.   background-repeat: repeat-y;
  8784.   background-attachment: fixed;
  8785. }
  8786.  
  8787. User agents may treat 'fixed' as 'scroll'. However, it is recommended they
  8788. interpret 'fixed' correctly, at least for the HTML and BODY elements, since
  8789. there is no way for an author to provide an image only for those browsers
  8790. that support 'fixed'. See the section on conformance for details.
  8791.  
  8792. 'background-position'
  8793.      Value:         [ [<percentage> | <length> ]{1,2} | [ [top | center |
  8794.                     bottom] || [left | center | right] ] ] | inherit
  8795.      Initial:       0% 0%
  8796.      Applies to:    block-level and replaced elements
  8797.      Inherited:     no
  8798.      Percentages:   refer to the size of the box itself
  8799.      Media:         visual
  8800.  
  8801. If a background image has been specified, this property specifies its
  8802. initial position. Values have the following meanings:
  8803.  
  8804. <percentage> <percentage>
  8805.      With a value pair of '0% 0%', the upper left corner of the image is
  8806.      aligned with the upper left corner of the box's padding edge. A value
  8807.      pair of '100% 100%' places the lower right corner of the image in the
  8808.      lower right corner of padding area. With a value pair of '14% 84%', the
  8809.      point 14% across and 84% down the image is to be placed at the point
  8810.      14% across and 84% down the padding area.
  8811. <length> <length>
  8812.      With a value pair of '2cm 2cm', the upper left corner of the image is
  8813.      placed 2cm to the right and 2cm below the upper left corner of the
  8814.      padding area.
  8815. top left and left top
  8816.      Same as '0% 0%'.
  8817. top, top center, and center top
  8818.      Same as '50% 0%'.
  8819. right top and top right
  8820.      Same as '100% 0%'.
  8821. left, left center, and center left
  8822.      Same as '0% 50%'.
  8823. center and center center
  8824.      Same as '50% 50%'.
  8825. right, right center, and center right
  8826.      Same as '100% 50%'.
  8827. bottom left and left bottom
  8828.      Same as '0% 100%'.
  8829. bottom, bottom center, and center bottom
  8830.      Same as '50% 100%'.
  8831. bottom right and right bottom
  8832.      Same as '100% 100%'.
  8833.  
  8834. If only one percentage or length value is given, it sets the horizontal
  8835. position only, the vertical position will be 50%. If two values are given,
  8836. the horizontal position comes first. Combinations of length and percentage
  8837. values are allowed, (e.g., '50% 2cm'). Negative positions are allowed.
  8838. Keywords cannot be combined with percentage values or length values (all
  8839. possible combinations are given above).
  8840.  
  8841. Example(s):
  8842.  
  8843. BODY { background: url("banner.jpeg") right top }    /* 100%   0% */
  8844. BODY { background: url("banner.jpeg") top center }   /*  50%   0% */
  8845. BODY { background: url("banner.jpeg") center }       /*  50%  50% */
  8846. BODY { background: url("banner.jpeg") bottom }       /*  50% 100% */
  8847.  
  8848. If the background image is fixed within the viewport (see the
  8849. 'background-attachment' property), the image is placed relative to the
  8850. viewport instead of the element's padding area. For example,
  8851.  
  8852. Example(s):
  8853.  
  8854. BODY {
  8855.   background-image: url("logo.png");
  8856.   background-attachment: fixed;
  8857.   background-position: 100% 100%;
  8858.   background-repeat: no-repeat;
  8859. }
  8860.  
  8861. In the example above, the (single) image is placed in the lower-right corner
  8862. of the viewport.
  8863.  
  8864. 'background'
  8865.      Value:         [<'background-color'> || <'background-image'> ||
  8866.                     <'background-repeat'> || <'background-attachment'> ||
  8867.                     <'background-position'>] | inherit
  8868.      Initial:       not defined for shorthand properties
  8869.      Applies to:    all elements
  8870.      Inherited:     no
  8871.      Percentages:   allowed on 'background-position'
  8872.      Media:         visual
  8873.  
  8874. The 'background' property is a shorthand property for setting the individual
  8875. background properties (i.e., 'background-color', 'background-image',
  8876. 'background-repeat', 'background-attachment' and 'background-position') at
  8877. the same place in the style sheet.
  8878.  
  8879. The 'background' property first sets all the individual background
  8880. properties to their initial values, then assigns explicit values given in
  8881. the declaration.
  8882.  
  8883. Example(s):
  8884.  
  8885. In the first rule of the following example, only a value for
  8886. 'background-color' has been given and the other individual properties are
  8887. set to their initial value. In the second rule, all individual properties
  8888. have been specified.
  8889.  
  8890. BODY { background: red }
  8891. P { background: url("chess.png") gray 50% repeat fixed }
  8892.  
  8893. 14.3 Gamma correction
  8894.  
  8895. For information about gamma issues, please consult the the Gamma Tutorial in
  8896. the PNG specification ([PNG10]).
  8897.  
  8898. In the computation of gamma correction, UAs displaying on a CRT may assume
  8899. an ideal CRT and ignore any effects on apparent gamma caused by dithering.
  8900. That means the minimal handling they need to do on current platforms is:
  8901.  
  8902. PC using MS-Windows
  8903.      none
  8904. Unix using X11
  8905.      none
  8906. Mac using QuickDraw
  8907.      apply gamma 1.45 [ICC32] (ColorSync-savvy applications may simply pass
  8908.      the sRGB ICC profile to ColorSync to perform correct color correction)
  8909. SGI using X
  8910.      apply the gamma value from /etc/config/system.glGammaVal (the default
  8911.      value being 1.70; applications running on Irix 6.2 or above may simply
  8912.      pass the sRGB ICC profile to the color management system)
  8913. NeXT using NeXTStep
  8914.      apply gamma 2.22
  8915.  
  8916. "Applying gamma" means that each of the three R, G and B must be converted
  8917. to R'=Rgamma, G'=Ggamma, B'=Bgamma, before being handed to the OS.
  8918.  
  8919. This may rapidly be done by building a 256-element lookup table once per
  8920. browser invocation thus:
  8921.  
  8922. for i := 0 to 255 do
  8923.   raw := i / 255.0;
  8924.   corr := pow (raw, gamma);
  8925.   table[i] := trunc (0.5 + corr * 255.0)
  8926. end
  8927.  
  8928. which then avoids any need to do transcendental math per color attribute,
  8929. far less per pixel.
  8930.   ------------------------------------------------------------------------
  8931.   ------------------------------------------------------------------------
  8932.  
  8933.                                   15 Fonts
  8934.  
  8935. Contents
  8936.  
  8937.    * 15.1 Introduction
  8938.    * 15.2 Font specification
  8939.         o 15.2.1 Font specification properties
  8940.         o 15.2.2 Font family: the 'font-family' property
  8941.         o 15.2.3 Font styling: the 'font-style', 'font-variant',
  8942.           'font-weight' and 'font-stretch' properties
  8943.         o 15.2.4 Font size: the 'font-size' and 'font-size-adjust'
  8944.           properties
  8945.         o 15.2.5 Shorthand font property: the 'font' property
  8946.         o 15.2.6 Generic font families
  8947.              + serif
  8948.              + sans-serif
  8949.              + cursive
  8950.              + fantasy
  8951.              + monospace
  8952.    * 15.3 Font selection
  8953.         o 15.3.1 Font Descriptions and @font-face
  8954.         o 15.3.2 Descriptors for Selecting a Font: 'font-family',
  8955.           'font-style', 'font-variant', 'font-weight', 'font-stretch' and
  8956.           'font-size'
  8957.         o 15.3.3 Descriptors for Font Data Qualification: 'unicode-range'
  8958.         o 15.3.4 Descriptor for Numeric Values: 'units-per-em'
  8959.         o 15.3.5 Descriptor for Referencing: 'src'
  8960.         o 15.3.6 Descriptors for Matching: 'panose-1', 'stemv', 'stemh',
  8961.           'slope', 'cap-height', 'x-height', 'ascent', and 'descent'
  8962.         o 15.3.7 Descriptors for Synthesis: 'widths', 'bbox' and
  8963.           'definition-src'
  8964.         o 15.3.8 Descriptors for Alignment: 'baseline', 'centerline',
  8965.           'mathline', and 'topline'
  8966.         o 15.3.9 Examples
  8967.    * 15.4 Font Characteristics
  8968.         o 15.4.1 Introducing Font Characteristics
  8969.         o 15.4.2 Full font name
  8970.         o 15.4.3 Coordinate units on the em square
  8971.         o 15.4.4 Central Baseline
  8972.         o 15.4.5 Font Encoding
  8973.         o 15.4.6 Font family name
  8974.         o 15.4.7 Glyph widths
  8975.         o 15.4.8 Horizontal stem width
  8976.         o 15.4.9 Height of uppercase glyphs
  8977.         o 15.4.10 Height of lowercase glyphs
  8978.         o 15.4.11 Lower Baseline
  8979.         o 15.4.12 Mathematical Baseline
  8980.         o 15.4.13 Maximal bounding box
  8981.         o 15.4.14 Maximum unaccented height
  8982.         o 15.4.15 Maximum unaccented depth
  8983.         o 15.4.16 Panose-1 number
  8984.         o 15.4.17 Range of ISO 10646 characters
  8985.         o 15.4.18 Top Baseline
  8986.         o 15.4.19 Vertical stem width
  8987.         o 15.4.20 Vertical stroke angle
  8988.    * 15.5 Font matching algorithm
  8989.         o 15.5.1 Mapping font weight values to font names
  8990.         o 15.5.2 Examples of font matching
  8991.  
  8992. 15.1 Introduction
  8993.  
  8994. When a document's text is to be displayed visually, characters (abstract
  8995. information elements) must be mapped to abstract glyphs. One or more
  8996. characters may be depicted by one or more abstract glyphs, in a possibly
  8997. context-dependent fashion. A glyph is the actual artistic representation of
  8998. an abstract glyph, in some typographic style, in the form of outlines or
  8999. bitmaps that may be drawn on the screen or paper. A font is a set of glyphs,
  9000. all observing the same basic motif according to design, size, appearance,
  9001. and other attributes associated with the entire set, and a mapping from
  9002. characters to abstract glyphs.
  9003.  
  9004. A visual user agent must address the following issues before actually
  9005. rendering a character:
  9006.  
  9007.    * Is there, directly or by inheritance, a font specified for this
  9008.      character?
  9009.    * Does the user agent have this font available?
  9010.    * If so, what glyph(s) does this character or sequence of characters map
  9011.      to?
  9012.    * If not, what should be done? Should a different font be substituted?
  9013.      Can the font be synthesized? Can it be retrieved from the Web?
  9014.  
  9015. In both CSS1 and CSS2, authors specify font characteristics via a series of
  9016. font properties.
  9017.  
  9018. How the user agent handles these properties, when there is no matching font
  9019. on the client has expanded between CSS1 and CSS2. In CSS1, all fonts were
  9020. assumed to be present on the client system and were identified solely by
  9021. name. Alternate fonts could be specified through the properties, but beyond
  9022. that, user agents had no way to propose other fonts to the user (even
  9023. stylistically similar fonts that the user agent had available) other than
  9024. generic default fonts.
  9025.  
  9026. CSS2 changes all that, and allows much greater liberty for:
  9027.  
  9028.    * style sheet authors, to describe the fonts they want to be used
  9029.    * user agents, in selecting a font when an author's requested font is not
  9030.      immediately available.
  9031.  
  9032. CSS2 improves client-side font matching, enables font synthesis and
  9033. progressive rendering, and enables fonts to be downloaded over the Web.
  9034. These enhanced capabilities are referred to as 'WebFonts'
  9035.  
  9036. In the CSS2 font model, as in CSS1, each user agent has a "font database" at
  9037. its disposition. CSS1 referred to this database but gave no details about
  9038. what was in it. CSS2 defines the information in that database and allows
  9039. style sheet authors to contribute to it. When asked to display a character
  9040. with a particular font, the user agent first identifies the font in the
  9041. database that "best fits" the specified font (according to the font matching
  9042. algorithm) Once it has identified a font, it retrieves the font data locally
  9043. or from the Web, and may display the character using those glyphs.
  9044.  
  9045. In light of this model, we have organized the specification into two
  9046. sections. The first concerns the font specification mechanism, whereby
  9047. authors specify which fonts they would like to have used. The second
  9048. concerns the font selection mechanism, whereby the client's user agent
  9049. identifies and loads a font that best fits the author's specification.
  9050.  
  9051. How the user agent constructs the font database lies outside the scope of
  9052. this specification since the database's implementation depends on such
  9053. factors as the operating system, the windowing system, and the client.
  9054.  
  9055. 15.2 Font specification
  9056.  
  9057. The first phase of the CSS font mechanism concerns how style sheet authors
  9058. specify which fonts should be used by a user agent. At first, it seem that
  9059. the obvious way to specify a font is by it's name, a single string - which
  9060. appears to be separated into distinct parts; for example "BT Swiss 721 Heavy
  9061. Italic".
  9062.  
  9063. Unfortunately, there exists no well-defined and universally accepted
  9064. taxonomy for classifying fonts based on their names, and terms that apply to
  9065. one font family name may not be appropriate for others. For example, the
  9066. term 'italic' is commonly used to label slanted text, but slanted text may
  9067. also be labeled Oblique, Slanted, Incline, Cursive, or Kursiv. Similarly,
  9068. font names typically contain terms that describe the "weight" of a font. The
  9069. primary role of these names is to distinguish faces of differing darkness
  9070. within a single font family. There is no accepted, universal meaning to
  9071. these weight names and usage varies widely. For example a font that you
  9072. might think of as being bold might be described as being Regular, Roman,
  9073. Book, Medium, Semi- or Demi-Bold, Bold, or Black, depending on how black the
  9074. "normal" face of the font is within the design.
  9075.  
  9076. This lack of systematic naming makes it impossible, in the general case, to
  9077. generate a modified font face name that differs in a particular way, such as
  9078. being bolder.
  9079.  
  9080. Because of this, CSS uses a different model. Fonts are requested not through
  9081. a single font name but through setting a series of font properties. These
  9082. property values form the basis of the user agent's font selection mechanism.
  9083. The font properties can be individually modified, for example to increase
  9084. the boldness, and the new set of font property values will then be used to
  9085. select from the font database again. The result is an increase in regularity
  9086. for style sheet authors and implementors, and an increase in robustness.
  9087.  
  9088. 15.2.1 Font specification properties
  9089.  
  9090. CSS2 specifies fonts according to these characteristics:
  9091.  
  9092. Font family
  9093.      The font family specifies which font family is to be used to render the
  9094.      text. A font family is a group of fonts,designed to be used in
  9095.      combination and exhibiting similarities in design. One member of the
  9096.      family may be italic, another bold, another condensed or using small
  9097.      caps. Font family names include "Helvetica", "New Century Schoolbook",
  9098.      and "Kyokasho ICA L". Font family names are not restricted to Latin
  9099.      characters. Font families may be grouped into different categories:
  9100.      those with or without serifs, those whose characters are or are not
  9101.      proportionally spaced, those that resemble handwriting, those that are
  9102.      fantasy fonts, etc.
  9103. Font style
  9104.      The font style specifies whether the text is to be rendered using a
  9105.      normal, italic, or oblique face. Italic is a more cursive companion
  9106.      face to the normal face, but not so cursive as to make it a script
  9107.      face. Oblique is a slanted form of the normal face, and is more
  9108.      commonly used as a companion face to sans-serif. This definition avoids
  9109.      having to label slightly slanted normal faces as oblique, or normal
  9110.      Greek faces as italic.
  9111. Font variant
  9112.      The font variant indicates whether the text is to be rendered using the
  9113.      normal glyphs for lowercase characters or using small-caps glyphs for
  9114.      lowercase characters. A particular font may contain only normal, only
  9115.      small-caps, or both types of glyph; this property is used to request an
  9116.      appropriate font and, if the font contains both variants, the
  9117.      appropriate glyphs.
  9118. Font weight
  9119.      The font weight refers to the boldness or lightness of the glyphs used
  9120.      to render the text, relative to other fonts in the same font family.
  9121. Font stretch
  9122.      The font stretch indicates the desired amount of condensing or
  9123.      expansion in the glyphs used to render the text, relative to other
  9124.      fonts in the same font family.
  9125. Font size
  9126.      The font size refers to the size of the font from baseline to baseline,
  9127.      when set solid (in CSS terms, this is when the 'font-size' and
  9128.      'line-height' properties have the same value).
  9129.  
  9130. On all properties except 'font-size', 'em' and 'ex' length values refer to
  9131. the font size of the current element. For 'font-size', these length units
  9132. refer to the font size of the parent element. Please consult the section on
  9133. length units for more information.
  9134.  
  9135. The CSS font properties are used to describe the desired appearance of text
  9136. in the document. The font descriptors, in contrast, are used to describe the
  9137. characteristics of fonts, so that a suitable font can be chosen to create
  9138. the desired appearance. For information about the classification of fonts,
  9139. please consult the section on font descriptors.
  9140.  
  9141. 15.2.2 Font family: the 'font-family' property
  9142.  
  9143. 'font-family'
  9144.      Value:         [[ <family-name> | <generic-family> ],]* [<family-name>
  9145.                     | <generic-family>] | inherit
  9146.      Initial:       depends on user agent
  9147.      Applies to:    all elements
  9148.      Inherited:     yes
  9149.      Percentages:   N/A
  9150.      Media:         visual
  9151.  
  9152. This property specifies a prioritized list of font family names and/or
  9153. generic family names. To deal with the problem that a single font may not
  9154. contain glyphs to display all the characters in a document, or that not all
  9155. fonts are available on all systems, this property allows authors to specify
  9156. a list of fonts, all of the same style and size, that are tried in sequence
  9157. to see if they contain a glyph for a certain character. This list is called
  9158. a font set.
  9159.  
  9160. Example(s):
  9161.  
  9162. For example, text that contains English words mixed with mathematical
  9163. symbols may need a font set of two fonts, one containing Latin letters and
  9164. digits, the other containing mathematical symbols. Here is an example of a
  9165. font set suitable for a text that is expected to contain text with Latin
  9166. characters, Japanese characters, and mathematical symbols:
  9167.  
  9168. BODY { font-family: Baskerville, "Heisi Mincho W3", Symbol, serif }
  9169.  
  9170. The glyphs available in the "Baskerville" font (a font that covers only
  9171. Latin characters) will be taken from that font, Japanese glyphs will be
  9172. taken from "Heisi Mincho W3", and the mathematical symbol glyphs will come
  9173. from "Symbol". Any others will come from the generic font family 'serif'.
  9174.  
  9175. The generic font family will be used if one or more of the other fonts in a
  9176. font set is unavailable. Although many fonts provide the "missing character"
  9177. glyph, typically an open box, as its name implies this should not be
  9178. considered a match except for the last font in a font set.
  9179.  
  9180. There are two types of font family names:
  9181.  
  9182. <family-name>
  9183.      The name of a font family of choice. In the previous example,
  9184.      "Baskerville", "Heisi Mincho W3", and "Symbol" are font families. Font
  9185.      family names containing whitespace should be quoted. If quoting is
  9186.      omitted, any whitespace characters before and after the font name are
  9187.      ignored and any sequence of whitespace characters inside the font name
  9188.      is converted to a single space.
  9189. <generic-family>
  9190.      The following generic families are defined: 'serif', 'sans-serif',
  9191.      'cursive', 'fantasy', and 'monospace'. Please see the section on
  9192.      generic font families for descriptions of these families. Generic font
  9193.      family names are keywords, and therefore must not be quoted.
  9194.  
  9195.      Authors are encouraged to offer a generic font family as a last
  9196.      alternative, for improved robustness.
  9197.  
  9198. For example:
  9199.  
  9200. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  9201. <HTML>
  9202.   <HEAD>
  9203.     <TITLE>Font test</TITLE>
  9204.     <STYLE type="text/css">
  9205.       BODY { font-family: "new century schoolbook", serif }
  9206.     </STYLE>
  9207.   </HEAD>
  9208.   <BODY>
  9209.    <H1 style="font-family: 'My own font', fantasy">Test</H1>
  9210.     <P>What's up, Doc?
  9211.   </BODY>
  9212. </HTML>
  9213.  
  9214. Example(s):
  9215.  
  9216. The richer selector syntax of CSS2 may be used to create language-sensitive
  9217. typography. For example, some Chinese and Japanese characters are unified to
  9218. have the same Unicode codepoint, although the abstract glyphs are not the
  9219. same in the two languages.
  9220.  
  9221. *:lang(ja-jp) { font: 900 14pt/16pt "Heisei Mincho W9", serif }
  9222. *:lang(zh-tw) { font: 800 14pt/16.5pt "Li Sung", serif }
  9223.  
  9224. This selects any element that has the given language - Japanese or
  9225. Traditional Chinese - and requests the appropriate font.
  9226.  
  9227. 15.2.3 Font styling: the 'font-style', 'font-variant', 'font-weight' and
  9228. 'font-stretch' properties
  9229.  
  9230. 'font-style'
  9231.      Value:         normal | italic | oblique | inherit
  9232.      Initial:       normal
  9233.      Applies to:    all elements
  9234.      Inherited:     yes
  9235.      Percentages:   N/A
  9236.      Media:         visual
  9237.  
  9238. The 'font-style' property requests normal (sometimes referred to as "roman"
  9239. or "upright"), italic, and oblique faces within a font family. Values have
  9240. the following meanings:
  9241.  
  9242. normal
  9243.      Specifies a font that is classified as 'normal' in the UA's font
  9244.      database.
  9245. oblique
  9246.      Specifies a font that is classified as 'oblique' in the UA's font
  9247.      database. Fonts with Oblique, Slanted, or Incline in their names will
  9248.      typically be labeled 'oblique' in the font database. A font that is
  9249.      labeled 'oblique' in the UA's font database may actually have been
  9250.      generated by electronically slanting a normal font.
  9251. italic
  9252.      Specifies a font that is classified as 'italic' in the UA's font
  9253.      database, or, if that is not available, one labeled 'oblique'. Fonts
  9254.      with Italic, Cursive, or Kursiv in their names will typically be
  9255.      labeled 'italic'.
  9256.  
  9257. Example(s):
  9258.  
  9259. In this example, normal text in an H1, H2, or H3 element will be displayed
  9260. with an italic font. However, emphasized text (EM) within an H1 will appear
  9261. in a normal face.
  9262.  
  9263. H1, H2, H3 { font-style: italic }
  9264. H1 EM { font-style: normal }
  9265.  
  9266. 'font-variant'
  9267.      Value:         normal | small-caps | inherit
  9268.      Initial:       normal
  9269.      Applies to:    all elements
  9270.      Inherited:     yes
  9271.      Percentages:   N/A
  9272.      Media:         visual
  9273.  
  9274. In a small-caps font, the glyphs for lowercase letters look similar to the
  9275. uppercase ones, but in a smaller size and with slightly different
  9276. proportions. The 'font-variant' property requests such a font for bicameral
  9277. (having two cases, as with Latin script). This property has no visible
  9278. effect for scripts that are unicameral (having only one case, as with most
  9279. of the world's writing systems). Values have the following meanings:
  9280.  
  9281. normal
  9282.      Specifies a font that is not labeled as a small-caps font.
  9283. small-caps
  9284.      Specifies a font that is labeled as a small-caps font. If a genuine
  9285.      small-caps font is not available, user agents should simulate a
  9286.      small-caps font, for example by taking a normal font and replacing the
  9287.      lowercase letters by scaled uppercase characters. As a last resort,
  9288.      unscaled uppercase letter glyphs in a normal font may replace glyphs in
  9289.      a small-caps font so that the text appears in all uppercase letters.
  9290.  
  9291. Example(s):
  9292.  
  9293. The following example results in an H3 element in small-caps, with
  9294. emphasized words (EM) in oblique small-caps:
  9295.  
  9296. H3 { font-variant: small-caps }
  9297. EM { font-style: oblique }
  9298.  
  9299. Insofar as this property causes text to be transformed to uppercase, the
  9300. same considerations as for 'text-transform' apply.
  9301.  
  9302. 'font-weight'
  9303.      Value:         normal | bold | bolder | lighter | 100 | 200 | 300 | 400
  9304.                     | 500 | 600 | 700 | 800 | 900 | inherit
  9305.      Initial:       normal
  9306.      Applies to:    all elements
  9307.      Inherited:     yes
  9308.      Percentages:   N/A
  9309.      Media:         visual
  9310.  
  9311. The 'font-weight' property specifies the weight of the font. Values have the
  9312. following meanings:
  9313.  
  9314. 100 to 900
  9315.      These values form an ordered sequence, where each number indicates a
  9316.      weight that is at least as dark as its predecessor.
  9317. normal
  9318.      Same as '400'.
  9319. bold
  9320.      Same as '700'.
  9321. bolder
  9322.      Specifies the next weight that is assigned to a font that is darker
  9323.      than the inherited one. If there is no such weight, it simply results
  9324.      in the next darker numerical value (and the font remains unchanged),
  9325.      unless the inherited value was '900', in which case the resulting
  9326.      weight is also '900'.
  9327. lighter
  9328.      Specifies the next weight that is assigned to a font that is lighter
  9329.      than the inherited one. If there is no such weight, it simply results
  9330.      in the next lighter numerical value (and the font remains unchanged),
  9331.      unless the inherited value was '100', in which case the resulting
  9332.      weight is also '100'.
  9333.  
  9334. Example(s):
  9335.  
  9336. P { font-weight: normal }   /* 400 */
  9337. H1 { font-weight: 700 }     /* bold */
  9338. BODY { font-weight: 400 }
  9339. STRONG { font-weight: bolder } /* 500 if available */
  9340.  
  9341. Child elements inherit the computed value of the weight.
  9342.  
  9343. 'font-stretch'
  9344.      Value:         normal | wider | narrower | ultra-condensed |
  9345.                     extra-condensed | condensed | semi-condensed |
  9346.                     semi-expanded | expanded | extra-expanded |
  9347.                     ultra-expanded | inherit
  9348.      Initial:       normal
  9349.      Applies to:    all elements
  9350.      Inherited:     yes
  9351.      Percentages:   N/A
  9352.      Media:         visual
  9353.  
  9354. The 'font-stretch' property selects a normal, condensed, or extended face
  9355. from a font family. Absolute keyword values have the following ordering,
  9356. from narrowest to widest :
  9357.  
  9358.   1. ultra-condensed
  9359.   2. extra-condensed
  9360.   3. condensed
  9361.   4. semi-condensed
  9362.   5. normal
  9363.   6. semi-expanded
  9364.   7. expanded
  9365.   8. extra-expanded
  9366.   9. ultra-expanded
  9367.  
  9368. The relative keyword 'wider' sets the value to the next expanded value above
  9369. the inherited value (while not increasing it above 'ultra-expanded'); the
  9370. relative keyword 'narrower' sets the value to the next condensed value below
  9371. the inherited value (while not decreasing it below 'ultra-condensed').
  9372.  
  9373. 15.2.4 Font size: the 'font-size' and 'font-size-adjust' properties
  9374.  
  9375. 'font-size'
  9376.      Value:         <absolute-size> | <relative-size> | <length> |
  9377.                     <percentage> | inherit
  9378.      Initial:       medium
  9379.      Applies to:    all elements
  9380.      Inherited:     yes, the computed value is inherited
  9381.      Percentages:   refer to parent element's font size
  9382.      Media:         visual
  9383.  
  9384. This property describes the size of the font when set solid. Values have the
  9385. following meanings:
  9386.  
  9387. <absolute-size>
  9388.      An <absolute-size> keyword refers to an entry in a table of font sizes
  9389.      computed and kept by the user agent. Possible values are:
  9390.  
  9391.      [ xx-small | x-small | small | medium | large | x-large | xx-large ]
  9392.  
  9393.      On a computer screen a scaling factor of 1.2 is suggested between
  9394.      adjacent indexes; if the 'medium' font is 12pt, the 'large' font could
  9395.      be 14.4pt. Different media may need different scaling factors. Also,
  9396.      the user agent should take the quality and availability of fonts into
  9397.      account when computing the table. The table may be different from one
  9398.      font family to another.
  9399.  
  9400.      Note. In CSS1, the suggested scaling factor between adjacent indexes
  9401.      was 1.5 which user experience proved to be too large.
  9402.  
  9403. <relative-size>
  9404.      A <relative-size> keyword is interpreted relative to the table of font
  9405.      sizes and the font size of the parent element. Possible values are:
  9406.  
  9407.      [ larger | smaller ]
  9408.  
  9409.      For example, if the parent element has a font size of 'medium', a value
  9410.      of 'larger' will make the font size of the current element be 'large'.
  9411.      If the parent element's size is not close to a table entry, the user
  9412.      agent is free to interpolate between table entries or round off to the
  9413.      closest one. The user agent may have to extrapolate table values if the
  9414.      numerical value goes beyond the keywords.
  9415. <length>
  9416.      A length value specifies an absolute font size (that is independent of
  9417.      the user agent's font table). Negative lengths are illegal.
  9418. <percentage>
  9419.      A percentage value specifies an absolute font size relative to the
  9420.      parent element's font size. Use of percentage values, or values in
  9421.      'em's, leads to more robust and cascadable style sheets.
  9422.  
  9423. The actual value of this property may differ from the computed value due a
  9424. numerical value on 'font-size-adjust' and the unavailability of certain font
  9425. sizes.
  9426.  
  9427. Child elements inherit the computed 'font-size' value (otherwise, the effect
  9428. of 'font-size-adjust' would compound).
  9429.  
  9430. Example(s):
  9431.  
  9432. P { font-size: 12pt; }
  9433. BLOCKQUOTE { font-size: larger }
  9434. EM { font-size: 150% }
  9435. EM { font-size: 1.5em }
  9436.  
  9437. 'font-size-adjust'
  9438.      Value:         <number> | none | inherit
  9439.      Initial:       none
  9440.      Applies to:    all elements
  9441.      Inherited:     yes
  9442.      Percentages:   N/A
  9443.      Media:         visual
  9444.  
  9445. In bicameral scripts, the subjective apparent size and legibility of a font
  9446. are less dependent on their 'font-size' value than on the value of their
  9447. 'x-height', or, more usefully, on the ratio of these two values, called the
  9448. aspect value (font size divided by x-height). The higher the aspect value,
  9449. the more likely it is that a font at smaller sizes will be legible.
  9450. Inversely, faces with a lower aspect value will become illegible more
  9451. rapidly below a given threshold size than faces with a higher aspect value.
  9452. Straightforward font substitution that relies on font size alone may lead to
  9453. illegible characters.
  9454.  
  9455. For example, the popular font Verdana has an aspect value of 0.58; when
  9456. Verdana's font size 100 units, its x-height is 58 units. For comparison,
  9457. Times New Roman has an aspect value of 0.46. Verdana will therefore tend to
  9458. remain legible at smaller sizes than Times New Roman. Conversely, Verdana
  9459. will often look 'too big' if substituted for Times New Roman at a chosen
  9460. size.
  9461.  
  9462. This property allows authors to specify an aspect value for an element that
  9463. will preserve the x-height of the first choice font in the substitute font.
  9464. Values have the following meanings:
  9465.  
  9466. none
  9467.      Do not preserve the font's x-height.
  9468. <number>
  9469.      Specifies the aspect value. The number refers to the aspect value of
  9470.      the first choice font. The scaling factor for available fonts is
  9471.      computed according to the following formula:
  9472.  
  9473.        y(a/a') = c
  9474.  
  9475.      where:
  9476.  
  9477.      y = 'font-size' of first-choice font
  9478.      a' = aspect value of available font
  9479.      c = 'font-size' to apply to available font
  9480.  
  9481. Example(s):
  9482.  
  9483. For example, if 14px Verdana (with an aspect value of 0.58) was unavailable
  9484. and an available font had an aspect value of 0.46, the font-size of the
  9485. substitute would be 14 * (0.58/0.46) = 17.65px.
  9486.  
  9487. Font size adjustments take place when computing the actual value of
  9488. 'font-size'. Since inheritance is based on the computed value, child
  9489. elements will inherit unadjusted values.
  9490.  
  9491. The first image below shows several typefaces rasterized at a common font
  9492. size (11pt. at 72 ppi), together with their aspect values. Note that faces
  9493. with higher aspect values appear larger than those with lower. Faces with
  9494. very low aspect values are illegible at the size shown.
  9495.  
  9496. [Comparison of 12 point fonts]
  9497.  
  9498. The next image shows the results of 'font-size-adjust' where Verdana has
  9499. been taken as the"first choice", together with the scaling factor applied.
  9500. As adjusted, the apparent sizes are nearly linear across faces, though the
  9501. actual (em) sizes vary by more than 100%. Note that 'font-size-adjust' tends
  9502. to stabilize the horizontal metrics of lines, as well.
  9503.  
  9504. [Comparison of font-adjusted fonts]
  9505.  
  9506. 15.2.5 Shorthand font property: the 'font' property
  9507.  
  9508. 'font'
  9509.      Value:         [ [ <'font-style'> || <'font-variant'> ||
  9510.                     <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]?
  9511.                     <'font-family'> ] | caption | icon | menu | message-box
  9512.                     | small-caption | status-bar | inherit
  9513.      Initial:       see individual properties
  9514.      Applies to:    all elements
  9515.      Inherited:     yes
  9516.      Percentages:   allowed on 'font-size' and 'line-height'
  9517.      Media:         visual
  9518.  
  9519. The 'font' property is, except as described below, a shorthand property for
  9520. setting 'font-style', 'font-variant', 'font-weight', 'font-size',
  9521. 'line-height', and 'font-family', at the same place in the style sheet. The
  9522. syntax of this property is based on a traditional typographical shorthand
  9523. notation to set multiple properties related to fonts.
  9524.  
  9525. All font-related properties are first reset to their initial values,
  9526. including those listed in the preceding paragraph plus 'font-stretch' and
  9527. 'font-size-adjust'. Then, those properties that are given explicit values in
  9528. the 'font' shorthand are set to those values. For a definition of allowed
  9529. and initial values, see the previously defined properties. For reasons of
  9530. backwards compatibility, it is not possible to set 'font-stretch' and
  9531. 'font-size-adjust' to other than their initial values using the 'font'
  9532. shorthand property; instead, set the individual properties.
  9533.  
  9534. Example(s):
  9535.  
  9536. P { font: 12pt/14pt sans-serif }
  9537. P { font: 80% sans-serif }
  9538. P { font: x-large/110% "new century schoolbook", serif }
  9539. P { font: bold italic large Palatino, serif }
  9540. P { font: normal small-caps 120%/120% fantasy }
  9541. P { font: oblique 12pt "Helvetica Nue", serif; font-stretch: condensed }
  9542.  
  9543. In the second rule, the font size percentage value ('80%') refers to the
  9544. font size of the parent element. In the third rule, the line height
  9545. percentage ('110%') refers to the font size of the element itself.
  9546.  
  9547. The first three rules do not specify the 'font-variant' and 'font-weight'
  9548. explicitly, so these properties receive their initial values ('normal').
  9549. Notice that the font family name "new century schoolbook", which contains
  9550. spaces, is enclosed in quotes. The fourth rule sets the 'font-weight' to
  9551. 'bold', the 'font-style' to 'italic', and implicitly sets 'font-variant' to
  9552. 'normal'.
  9553.  
  9554. The fifth rule sets the 'font-variant' ('small-caps'), the 'font-size' (120%
  9555. of the parent's font size), the 'line-height' (120% of the font size) and
  9556. the 'font-family' ('fantasy'). It follows that the keyword 'normal' applies
  9557. to the two remaining properties: 'font-style' and 'font-weight'.
  9558.  
  9559. The sixth rule sets the 'font-style', 'font-size', and 'font-family', the
  9560. other font properties being set to their initial values. It then sets
  9561. 'font-stretch' to 'condensed' since that property cannot be set to that
  9562. value using the 'font' shorthand property.
  9563.  
  9564. The following values refer to system fonts:
  9565.  
  9566. caption
  9567.      The font used for captioned controls (e.g., buttons, drop-downs, etc.).
  9568. icon
  9569.      The font used to label icons.
  9570. menu
  9571.      The font used in menus (e.g., dropdown menus and menu lists).
  9572. message-box
  9573.      The font used in dialog boxes.
  9574. small-caption
  9575.      The font used for labeling small controls.
  9576. status-bar
  9577.      The font used in window status bars.
  9578.  
  9579. System fonts may only be set as a whole; that is, the font family, size,
  9580. weight, style, etc. are all set at the same time.These values may then be
  9581. altered individually if desired. If no font with the indicated
  9582. characteristics exists on a given platform, the user agent should either
  9583. intelligently substitute (e.g., a smaller version of the 'caption' font
  9584. might be used for the 'smallcaption' font), or substitute a user agent
  9585. default font. As for regular fonts, if, for a system font, any of the
  9586. individual properties are not part of the operating system's available user
  9587. preferences, those properties should be set to their initial values.
  9588.  
  9589. That is why this property is "almost" a shorthand property: system fonts can
  9590. only be specified with this property, not with 'font-family' itself, so
  9591. 'font' allows authors to do more than the sum of its subproperties. However,
  9592. the individual properties such as 'font-weight' are still given values taken
  9593. from the system font, which can be independently varied.
  9594.  
  9595. Example(s):
  9596.  
  9597. BUTTON { font: 300 italic 1.3em/1.7em "FB Armada", sans-serif }
  9598. BUTTON P { font: menu }
  9599. BUTTON P EM { font-weight: bolder }
  9600.  
  9601. If the font used for dropdown menus on a particular system happened to be,
  9602. for example, 9-point Charcoal, with a weight of 600, then P elements that
  9603. were descendants of BUTTON would be displayed as if this rule were in
  9604. effect:
  9605.  
  9606. BUTTON P { font: 600 9pt Charcoal }
  9607.  
  9608. Because the 'font' shorthand resets to its initial value any property not
  9609. explicitly given a value, this has the same effect as this declaration:
  9610.  
  9611. BUTTON P {
  9612.   font-style: normal;
  9613.   font-variant: normal;
  9614.   font-weight: 600;
  9615.   font-size: 9pt;
  9616.   line-height: normal;
  9617.   font-family: Charcoal
  9618. }
  9619.  
  9620. 15.2.6 Generic font families
  9621.  
  9622. Generic font families are a fallback mechanism, a means of preserving some
  9623. of the style sheet author's intent in the worst case when none of the
  9624. specified fonts can be selected. For optimum typographic control, particular
  9625. named fonts should be used in style sheets.
  9626.  
  9627. All five generic font families are defined to exist in all CSS
  9628. implementations (they need not necessarily map to five distinct actual
  9629. fonts). User agents should provide reasonable default choices for the
  9630. generic font families, which express the characteristics of each family as
  9631. well as possible within the limits allowed by the underlying technology.
  9632.  
  9633. User agents are encouraged to allow users to select alternative choices for
  9634. the generic fonts.
  9635.  
  9636. serif
  9637.  
  9638. Glyphs of serif fonts, as the term is used in CSS, have finishing strokes,
  9639. flared or tapering ends, or have actual serifed endings (including slab
  9640. serifs). Serif fonts are typically proportionately-spaced. They often
  9641. display a greater variation between thick and thin strokes than fonts from
  9642. the 'sans-serif' generic font family. CSS uses the term 'serif' to apply to
  9643. a font for any script, although other names may be more familiar for
  9644. particular scripts, such as Mincho (Japanese), Sung or Song (Chinese), Totum
  9645. or Kodig (Korean). Any font that is so described may be used to represent
  9646. the generic 'serif' family.
  9647.  
  9648. Examples of fonts that fit this description include:
  9649.  
  9650.  Latin fonts    Times New Roman, Bodoni, Garamond, Minion Web, ITC Stone
  9651.                 Serif, MS Georgia, Bitstream Cyberbit
  9652.  Greek fonts    Bitstream Cyberbit
  9653.  
  9654.  Cyrillic fonts Adobe Minion Cyrillic, Excelcior Cyrillic Upright, Monotype
  9655.                 Albion 70, Bitstream Cyberbit, ER Bukinst
  9656.  Hebrew fonts   New Peninim, Raanana, Bitstream Cyberbit
  9657.  Japanese fonts Ryumin Light-KL, Kyokasho ICA, Futo Min A101
  9658.  Arabic fonts   Bitstream Cyberbit
  9659.  Cherokee fonts Lo Cicero Cherokee
  9660.  
  9661. sans-serif
  9662.  
  9663. Glyphs in sans-serif fonts, as the term is used in CSS, have stroke endings
  9664. that are plain -- without any flaring, cross stroke, or other ornamentation.
  9665. Sans-serif fonts are typically proportionately-spaced. They often have
  9666. little variation between thick and thin strokes, compared to fonts from the
  9667. 'serif' family. CSS uses the term 'sans-serif' to apply to a font for any
  9668. script, although other names may be more familiar for particular scripts,
  9669. such as Gothic (Japanese), Kai (Chinese), or Pathang (Korean). Any font that
  9670. is so described may be used to represent the generic 'sans-serif' family.
  9671.  
  9672. Examples of fonts that fit this description include:
  9673.  
  9674.                 MS Trebuchet, ITC Avant Garde Gothic, MS Arial, MS Verdana,
  9675.  Latin fonts    Univers, Futura, ITC Stone Sans, Gill Sans, Akzidenz
  9676.                 Grotesk, Helvetica
  9677.  
  9678.  Greek fonts    Attika, Typiko New Era, MS Tahoma, Monotype Gill Sans 571,
  9679.                 Helvetica Greek
  9680.  
  9681.  Cyrillic fonts Helvetica Cyrillic, ER Univers, Lucida Sans Unicode,
  9682.                 Bastion
  9683.  Hebrew fonts   Arial Hebrew, MS Tahoma
  9684.  Japanese fonts Shin Go, Heisei Kaku Gothic W5
  9685.  Arabic fonts   MS Tahoma
  9686.  
  9687. cursive
  9688.  
  9689. Glyphs in cursive fonts, as the term is used in CSS, generally have either
  9690. joining strokes or other cursive characteristics beyond those of italic
  9691. typefaces. The glyphs are partially or completely connected, and the result
  9692. looks more like handwritten pen or brush writing than printed letterwork.
  9693. Fonts for some scripts, such as Arabic, are almost always cursive. CSS uses
  9694. the term 'cursive' to apply to a font for any script, although other names
  9695. such as Chancery, Brush, Swing and Script are also used in font names.
  9696.  
  9697. Examples of fonts that fit this description include:
  9698.  
  9699.  Latin fonts    Caflisch Script, Adobe Poetica, Sanvito, Ex Ponto, Snell
  9700.                 Roundhand, Zapf-Chancery
  9701.  Cyrillic fonts ER Architekt
  9702.  Hebrew fonts   Corsiva
  9703.  Arabic fonts   DecoType Naskh, Monotype Urdu 507
  9704.  
  9705. fantasy
  9706.  
  9707. Fantasy fonts, as used in CSS, are primarily decorative while still
  9708. containing representations of characters (as opposed to Pi or Picture fonts,
  9709. which do not represent characters). Examples include:
  9710.  
  9711.  Latin fonts Alpha Geometrique, Critter, Cottonwood, FB Reactor, Studz
  9712.  
  9713. monospace
  9714.  
  9715. The sole criterion of a monospace font is that all glyphs have the same
  9716. fixed width. (This can make some scripts, such as Arabic, look most
  9717. peculiar.) The effect is similar to a manual typewriter, and is often used
  9718. to set samples of computer code.
  9719.  
  9720. Examples of fonts which fit this description include:
  9721.  Latin fonts    Courier, MS Courier New, Prestige, Everson Mono
  9722.  Greek Fonts    MS Courier New, Everson Mono
  9723.  Cyrillic fonts ER Kurier, Everson Mono
  9724.  Japanese fonts Osaka Monospaced
  9725.  Cherokee fonts Everson Mono
  9726.  
  9727. 15.3 Font selection
  9728.  
  9729. The second phase of the CSS2 font mechanism concerns the user agent's
  9730. selection of a font based on author-specified font properties, available
  9731. fonts, etc. The details of the font matching algorithm are provided below.
  9732.  
  9733. There are four possible font selection actions: name matching, intelligent
  9734. matching, synthesis, and download.
  9735.  
  9736. font name matching
  9737.      In this case, the user agent uses an existing, accessible font that has
  9738.      the same family name as the requested font. (Note that the appearance
  9739.      and the metrics might not necessarily match, if the font that the
  9740.      document author used and the font on the client system are from
  9741.      different foundries). The matching information is restricted to the CSS
  9742.      font properties, including the family name. This is the only method
  9743.      used by CSS1.
  9744. intelligent font matching
  9745.      In this case, the user agent uses an existing, accessible font that is
  9746.      the closest match in appearance to the requested font. (Note that the
  9747.      metrics might not match exactly). The matching information includes
  9748.      information about the kind of font (text or symbol), nature of serifs,
  9749.      weight, cap height, x height, ascent, descent, slant, etc.
  9750. font synthesis
  9751.      In this case, the user agent creates a font that is not only a close
  9752.      match in appearance, but also matches the metrics of the requested
  9753.      font. The synthesizing information includes the matching information
  9754.      and typically requires more accurate values for the parameters than are
  9755.      used for some matching schemes. In particular, synthesis requires
  9756.      accurate width metrics and character to glyph substitution and position
  9757.      information if all the layout characteristics of the specified font are
  9758.      to be preserved.
  9759. font download
  9760.      Finally, the user agent may retrieve a font over the Web. This is
  9761.      similar to the process of fetching images, sounds, or applets over the
  9762.      Web for display in the current document, and likewise can cause some
  9763.      delay before the page can be displayed.
  9764.  
  9765. Progressive rendering is a combination of download and one of the other
  9766. methods; it provides a temporary substitute font (using name matching,
  9767. intelligent matching, or synthesis) to allow content to be read while the
  9768. requested font downloads. Once the real font has been successfully
  9769. downloaded, it replaces the temporary font, hopefully without the need to
  9770. reflow.
  9771.  
  9772. Note. Progressive rendering requires metric information about the font in
  9773. order to avoid re-layout of the content when the actual font has been loaded
  9774. and rendered. This metric information is sufficiently verbose that it should
  9775. only be specified at most once per font in a document.
  9776.  
  9777. 15.3.1 Font Descriptions and @font-face
  9778.  
  9779. The font description provides the bridge between an author's font
  9780. specification and the font data, which is the data needed to format text and
  9781. to render the abstract glyphs to which the characters map - the actual
  9782. scalable outlines or bitmaps. Fonts are referenced by style sheet
  9783. properties.
  9784.  
  9785. The font description is added to the font database and then used to select
  9786. the relevant font data. The font description contains descriptors such as
  9787. the location of the font data on the Web, and characterizations of that font
  9788. data. The font descriptors are also needed to match the style sheet font
  9789. properties to particular font data. The level of detail of a font
  9790. description can vary from just the name of the font up to a list of glyph
  9791. widths.
  9792.  
  9793. Font descriptors may be classified into three types:
  9794.  
  9795.   1. those that provide the link between the CSS usage of the font and the
  9796.      font description (these have the same names as the corresponding CSS
  9797.      font properties),
  9798.   2. the URI for the location of the font data,
  9799.   3. those that further characterize the font, to provide a link between the
  9800.      font description and the font data.
  9801.  
  9802. All font descriptions are specified via a @font-face at-rule. The general
  9803. form is:
  9804.  
  9805. @font-face { <font-description> }
  9806.  
  9807. where the <font-description> has the form:
  9808.  
  9809. descriptor: value;
  9810. descriptor: value;
  9811. [...]
  9812. descriptor: value;
  9813.  
  9814. Each @font-face rule specifies a value for every font descriptor, either
  9815. implicitly or explicitly. Those not given explicit values in the rule take
  9816. the initial value listed with each descriptor in this specification. These
  9817. descriptors apply solely within the context of the @font-face rule in which
  9818. they are defined, and do not apply to document language elements. Thus,
  9819. there is no notion of which elements the descriptors apply to, or whether
  9820. the values are inherited by child elements.
  9821.  
  9822. The available font descriptors are described in later sections of this
  9823. specification.
  9824.  
  9825. For example, here the font 'Robson Celtic' is defined and referenced in a
  9826. style sheet contained in an HTML document.
  9827.  
  9828. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  9829. <HTML>
  9830.   <HEAD>
  9831.     <TITLE>Font test</TITLE>
  9832.     <STYLE TYPE="text/css" MEDIA="screen, print">
  9833.       @font-face {
  9834.         font-family: "Robson Celtic";
  9835.         src: url("http://site/fonts/rob-celt")
  9836.       }
  9837.       H1 { font-family: "Robson Celtic", serif }
  9838.     </STYLE>
  9839.   </HEAD>
  9840.   <BODY>
  9841.     <H1> This heading is displayed using Robson Celtic</H1>
  9842.   </BODY>
  9843. </HTML>
  9844.  
  9845. The style sheet (in the STYLE element) contains a CSS rule that sets all H1
  9846. elements to use the 'Robson Celtic' font family.
  9847.  
  9848. A CSS1 implementation will search the client for a font whose family name
  9849. and other properties match 'Robson Celtic' and, if it fails to find it, will
  9850. use the UA-specific fallback serif font (which is defined to exist).
  9851.  
  9852. A user agent implementing CSS2 will first examine @font-face rules in search
  9853. of a font description defining 'Robson Celtic'. This example contains a rule
  9854. that matches. Although this rule doesn't contain much font data, it does
  9855. have a URI where the font can be retrieved for rendering this document.
  9856. Downloaded fonts should not be made available to other applications. If no
  9857. matching @font-face is found, the user agent will attempt the same match as
  9858. a user agent implementing CSS1.
  9859.  
  9860. Note that if the font 'Robson Celtic' had been installed on the client
  9861. system, this would have caused the UA to add an entry in the font database
  9862. for the installed copy as described in the section on the font matching
  9863. algorithm. The installed copy would have been matched before the
  9864. downloadable font in the example above.
  9865.  
  9866. CSS1 implementations, which do not understand the @font-face rule, will
  9867. encounter the opening curly brackets and will ignore forward until the
  9868. matching closing curly brackets. This at-rule conforms with the
  9869. forward-compatible parsing requirement of CSS. Parsers may ignore these
  9870. rules without error.
  9871.  
  9872. Having the font descriptors separate from the font data has a benefit beyond
  9873. being able to do font selection and/or substitution. The data protection and
  9874. replication restrictions on the font descriptors may be much weaker than on
  9875. the full font data. Thus, it may be possible to install the font definition
  9876. locally, or at least to have it in a local cache if it occurs in a commonly
  9877. referenced style sheet; this would not require accessing the full font
  9878. definition over the Web more than once per named font.
  9879.  
  9880. If a font descriptor is duplicated, the last occurring descriptor wins and
  9881. the rest must be ignored.
  9882.  
  9883. Also, any descriptors that are not recognized or useful to the user agent
  9884. must be ignored. Future versions of CSS may allow additional descriptors for
  9885. the purpose of better font substitution, matching, or synthesis.
  9886.  
  9887. 15.3.2 Descriptors for Selecting a Font: 'font-family', 'font-style',
  9888. 'font-variant', 'font-weight', 'font-stretch' and 'font-size'
  9889.  
  9890. The following descriptors have the same names as the corresponding CSS2 font
  9891. properties, and take a single value or comma-separated list of values.
  9892.  
  9893. The values within that list are, except as explicitly noted, the same as
  9894. those for the corresponding CSS2 property. If there is a single value, that
  9895. is the value that must be matched. If there is a list, any list item
  9896. constitutes a match. If the descriptor is omitted from the @font-face, the
  9897. initial value for the descriptor is used.
  9898.  
  9899. 'font-family' (Descriptor)
  9900.      Value:     [ <family-name> | <generic-family> ] [, [<family-name> |
  9901.                 <generic-family> ]]*
  9902.      Initial:   depends on user agent
  9903.      Media:     visual
  9904.  
  9905. This is the descriptor for the font family name of a font and takes the same
  9906. values as the 'font-family' property.
  9907.  
  9908. 'font-style' (Descriptor)
  9909.      Value:     all | [ normal | italic | oblique ] [, [normal | italic |
  9910.                 oblique] ]*
  9911.      Initial:   all
  9912.      Media:     visual
  9913.  
  9914. This is the descriptor for the style of a font and takes the same values as
  9915. the 'font-style' property, except that a comma-separated list is permitted.
  9916.  
  9917. 'font-variant' (Descriptor)
  9918.      Value:     [normal | small-caps] [,[normal | small-caps]]*
  9919.      Initial:   normal
  9920.      Media:     visual
  9921.  
  9922. This is the CSS indication of whether this face is the small-caps variant of
  9923. a font. It takes the same values as the 'font-variant' property except that
  9924. a comma-separated list is permitted.
  9925.  
  9926. Note. Cyrillic pryamo? faces may be labeled with a 'font-variant' of
  9927. small-caps, which will give better consistency with Latin faces (and the
  9928. companion kursiv face labeled with 'font-style' italic for the same reason).
  9929.  
  9930. 'font-weight' (Descriptor)
  9931.      Value:     all | [normal | bold | 100 | 200 | 300 | 400 | 500 | 600 |
  9932.                 700 | 800 | 900] [, [normal | bold | 100 | 200 | 300 | 400 |
  9933.                 500 | 600 | 700 | 800 | 900]]*
  9934.      Initial:   all
  9935.      Media:     visual
  9936.  
  9937. This is the descriptor for the weight of a face relative to others in the
  9938. same font family. It takes the same values as the 'font-weight' property
  9939. with three exceptions:
  9940.  
  9941.   1. relative keywords (bolder, lighter) are not permitted.
  9942.   2. a comma-separated list of values is permitted, for fonts that contain
  9943.      multiple weights.
  9944.   3. an additional keyword, 'all' is permitted, which means that the font
  9945.      will match for all possible weights; either because it contains
  9946.      multiple weights, or because that face only has a single weight.
  9947.  
  9948. 'font-stretch' (Descriptor)
  9949.      Value:     all | [ normal | ultra-condensed | extra-condensed |
  9950.                 condensed | semi-condensed | semi-expanded | expanded |
  9951.                 extra-expanded | ultra-expanded ] [, [ normal |
  9952.                 ultra-condensed | extra-condensed | condensed |
  9953.                 semi-condensed | semi-expanded | expanded | extra-expanded |
  9954.                 ultra-expanded] ]*
  9955.      Initial:   normal
  9956.      Media:     visual
  9957.  
  9958. This is the CSS indication of the condensed or expanded nature of the face
  9959. relative to others in the same font family. It takes the same values as the
  9960. 'font-stretch' property except that:
  9961.  
  9962.    * relative keywords (wider, narrower) are not permitted
  9963.    * a comma-separated list is permitted
  9964.    * The keyword 'all' is permitted
  9965.  
  9966. 'font-size' (Descriptor)
  9967.      Value:     all | <length> [, <length>]*
  9968.      Initial:   all
  9969.      Media:     visual
  9970.  
  9971. This is the descriptor for the sizes provided by this font. Only absolute
  9972. length units are permitted, in contrast to the 'font-size' property, which
  9973. allows both relative and absolute lengths and sizes. A comma-separated list
  9974. of absolute lengths is permitted.
  9975.  
  9976. The initial value of 'all' is suitable for most scalable fonts, so this
  9977. descriptor is primarily for use in an @font-face for bitmap fonts, or
  9978. scalable fonts designed to be rasterised at a restricted range of font
  9979. sizes.
  9980.  
  9981. 15.3.3 Descriptors for Font Data Qualification: 'unicode-range'
  9982.  
  9983. The following descriptor is optional within a font definition, but is used
  9984. to avoid checking or downloading a font that does not have sufficient glyphs
  9985. to render a particular character.
  9986.  
  9987. 'unicode-range' (Descriptor)
  9988.      Value:     <urange> [, <urange>]*
  9989.      Initial:   U+0-7FFFFFFF
  9990.      Media:     visual
  9991.  
  9992. This is the descriptor for the range of ISO 10646 characters covered by the
  9993. font.
  9994.  
  9995. The values of <urange> are expressed using hexadecimal numbers prefixed by
  9996. "U+", corresponding to character code positions in ISO 10646 ([ISO10646]).
  9997.  
  9998. For example, U+05D1 is the ISO 10646 character 'Hebrew letter bet'. For
  9999. values outside the Basic Multilingual Plane (BMP), additional leading digits
  10000. corresponding to the plane number are added, also in hexadecimal, like this:
  10001. U+A1234 which is the character on Plane 10 at hexadecimal code position
  10002. 1234. At the time of writing no characters had been assigned outside the
  10003. BMP. Leading zeros (for example, 0000004D) are valid, but not required.
  10004.  
  10005. The initial value of this descriptor covers not only the entire Basic
  10006. Multilingual Plane (BMP), which would be expressed as U+0-FFFF, but also the
  10007. whole repertoire of ISO 10646. Thus, the initial value says that the font
  10008. may have glyphs for characters anywhere in ISO 10646. Specifying a value for
  10009. 'unicode-range' provides information to make searching efficient, by
  10010. declaring a constrained range in which the font may have glyphs for
  10011. characters. The font need not be searched for characters outside this range.
  10012.  
  10013. Values may be written with any number of digits. For single numbers, the
  10014. character '?' is assumed to mean 'any value' which creates a range of
  10015. character positions. Thus, using a single number:
  10016.  
  10017. unicode-range: U+20A7
  10018.      no wild cards - it indicates a single character position (the Spanish
  10019.      peseta currency symbol)
  10020. unicode-range: U+215?
  10021.      one wild card, covers the range 2150 to 215F (the fractions)
  10022. unicode-range: U+00??
  10023.      two wild cards, covers the range 0000 to 00FF (Latin-1)
  10024. unicode-range: U+E??
  10025.      two wild cards, covers 0E00 to 0EFF (the Lao script)
  10026.  
  10027. A pair of numbers in this format can be combined with the dash character to
  10028. indicate larger ranges. For example:
  10029.  
  10030. unicode-range: U+AC00-D7FF
  10031.      the range is AC00 to D7FF (the Hangul Syllables area)
  10032.  
  10033. Multiple, discontinuous ranges can be specified, separated by a comma. As
  10034. with other comma-separated lists in CSS, any whitespace before or after the
  10035. comma is ignored. For example:
  10036.  
  10037. unicode-range: U+370-3FF, U+1F??
  10038.      This covers the range 0370 to 03FF (Modern Greek) plus 1F00 to 1FFF
  10039.      (Ancient polytonic Greek).
  10040. unicode-range: U+3000-303F, U+3100-312F, U+32??, U+33??, U+4E00-9FFF,
  10041. U+F9000-FAFF, U+FE30-FE4F
  10042.      Something of a worst case in terms of verbosity, this very precisely
  10043.      indicates that this (extremely large) font contains only Chinese
  10044.      characters from ISO 10646, without including any characters that are
  10045.      uniquely Japanese or Korean. The range is 3000 to 303F (CJK symbols and
  10046.      punctuation) plus 3100 to 312F (Bopomofo) plus 3200 to 32FF (enclosed
  10047.      CJK letters and months) plus 3300 to 33FF (CJK compatibility zone) plus
  10048.      4E00 to 9FFF (CJK unified Ideographs) plus F900 to FAFF (CJK
  10049.      compatibility ideographs) plus FE30 to FE4F (CJK compatibility forms).
  10050.  
  10051.      A more likely representation for a typical Chinese font would be:
  10052.  
  10053.      unicode-range: U+3000-33FF, U+4E00-9FFF
  10054.  
  10055. unicode-range: U+11E00-121FF
  10056.      This font covers a proposed registration for Aztec pictograms, covering
  10057.      the range 1E00 to 21FF in plane 1.
  10058. unicode-range: U+1A00-1A1F
  10059.      This font covers a proposed registration for Irish Ogham covering the
  10060.      range 1A00 to 1A1F
  10061.  
  10062. 15.3.4 Descriptor for Numeric Values: 'units-per-em'
  10063.  
  10064. The following descriptor specifies the number of "units" per em; these units
  10065. may be used by several other descriptors to express various lengths, so
  10066. 'units-per-em' is required if other descriptors depend on it.
  10067.  
  10068. 'units-per-em' (Descriptor)
  10069.      Value:     <number>
  10070.      Initial:   undefined
  10071.      Media:     visual
  10072.  
  10073. This is the descriptor for the number of the coordinate units on the em
  10074. square, the size of the design grid on which glyphs are laid out.
  10075.  
  10076. 15.3.5 Descriptor for Referencing: 'src'
  10077.  
  10078. This descriptor is required for referencing actual font data, whether
  10079. downloadable or locally installed.
  10080.  
  10081. 'src' (Descriptor)
  10082.      Value:     [ <uri> [format(<string> [, <string>]*)] | <font-face-name>
  10083.                 ] [, <uri> [format(<string> [, <string>]*)] |
  10084.                 <font-face-name> ]*
  10085.      Initial:   undefined
  10086.      Media:     visual
  10087.  
  10088. This is a prioritized, comma-separated list of external references and/or
  10089. locally installed font face names. The external reference points to the font
  10090. data on the Web. This is required if the WebFont is to be downloaded. The
  10091. font resource may be a subset of the source font, for example it may contain
  10092. only the glyphs needed for the current page or for a set of pages.
  10093.  
  10094. The external reference consists of a URI, followed by an optional hint
  10095. regarding the format of font resource to be found at that URI, and this
  10096. information should be used by clients to avoid following links to fonts in
  10097. formats they are unable to use. As with any hypertext reference, there may
  10098. be other formats available, but the client has a better idea of what is
  10099. likely to be there, in a more robust way than trying to parse filename
  10100. extensions in URIs.
  10101.  
  10102. The format hint contains a comma-separated list of format strings that
  10103. denote well-known font formats. The user agent will recognize the name of
  10104. font formats that it supports, and will avoid downloading fonts in formats
  10105. that it does not recognize.
  10106.  
  10107. An initial list of format strings defined by this specification and
  10108. representing formats likely to be used by implementations on various
  10109. platforms is:
  10110.  
  10111.        String                  Font Format             Examples of common
  10112.                                                            extensions
  10113.  
  10114.  "truedoc-pfr"      TrueDoc™ Portable Font     .pfr
  10115.                     Resource
  10116.  "embedded-opentype"Embedded OpenType                .eot
  10117.  "type-1"           PostScript™ Type 1         .pfb, .pfa
  10118.  "truetype"         TrueType                         .ttf
  10119.  
  10120.  "opentype"         OpenType, including TrueType     .ttf
  10121.                     Open
  10122.  "truetype-gx"      TrueType with GX extensions
  10123.  "speedo"           Speedo
  10124.  "intellifont"      Intellifont
  10125.  
  10126. As with other URIs in CSS, the URI may be partial, in which case it is
  10127. resolved relative to the location of the style sheet containing the
  10128. @font-face.
  10129.  
  10130. The locally-installed <font-face-name> is the full font name of a locally
  10131. installed font. The full font name is the name of the font as reported by
  10132. the operating system and is the name most likely to be used in reader style
  10133. sheets, browser default style sheets or possibly author style sheets on an
  10134. intranet. Adornments such as bold, italic, and underline are often used to
  10135. differentiate faces within a font family. For more information about full
  10136. font names please consult the notes below.
  10137.  
  10138. The notation for a <font-face-name> is the full font name, which must be
  10139. quoted since it may contain any character, including spaces and punctuation,
  10140. and also must be enclosed in "local(" and ")".
  10141.  
  10142. Example(s):
  10143.  
  10144. src: url("http://foo/bar")
  10145.      a full URI and no information about the font format(s) available there
  10146. src: local("BT Century 751 No. 2 Semi Bold Italic")
  10147.      references a particular face of a locally installed font
  10148. src: url("../fonts/bar") format("truedoc-pfr")
  10149.      a partial URI which has a font available in TrueDoc format
  10150. src: url("http://cgi-bin/bar?stuff") format("opentype", "intellifont")
  10151.      a full URI, in this case to a script, which can generate two different
  10152.      formats - OpenType and Intellifont
  10153. src: local("T-26 Typeka Mix"), url("http://site/magda-extra")
  10154. format("type-1")
  10155.      two alternatives are given, firstly a locally installed font and
  10156.      secondly a downloadable font available in Type 1 format.
  10157.  
  10158. Access to locally installed fonts is via the <font-face-name>. The font face
  10159. name is not truly unique, nor is it truly platform or font format
  10160. independent, but at the moment it is the best way to identify locally
  10161. installed font data. The use of the font face name can be made more accurate
  10162. by providing an indication of the glyph complement required. This may be
  10163. done by indicating the range of ISO 10646 character positions for which the
  10164. font provides some glyphs (see 'unicode-range').
  10165.  
  10166. 15.3.6 Descriptors for Matching: 'panose-1', 'stemv', 'stemh', 'slope',
  10167. 'cap-height', 'x-height', 'ascent', and 'descent'
  10168.  
  10169. These descriptors are optional for a CSS2 definition, but may be used if
  10170. intelligent font matching or font size adjustment is desired by the author.
  10171.  
  10172. 'panose-1' (Descriptor)
  10173.      Value:     [<integer>]{10}
  10174.      Initial:   0 0 0 0 0 0 0 0 0 0
  10175.      Media:     visual
  10176.  
  10177. This is the descriptor for the Panose-1 number and consists of ten decimal
  10178. integers, separated by whitespace. A comma-separated list is not permitted
  10179. for this descriptor, because the Panose-1 system can indicate that a range
  10180. of values are matched. The initial value is zero, which means "any", for
  10181. each PANOSE digit; all fonts will match the Panose number if this value is
  10182. used. Use of the Panose-1 descriptor is strongly recommended for latin
  10183. fonts. For further details, see Appendix C.
  10184.  
  10185. 'stemv' (Descriptor)
  10186.      Value:     <number>
  10187.      Initial:   undefined
  10188.      Media:     visual
  10189.  
  10190. This is the descriptor for the vertical stem width of the font. If the value
  10191. is undefined, the descriptor is not used for matching. If this descriptor is
  10192. used, the 'units-per-em' descriptor must also be used.
  10193.  
  10194. 'stemh' (Descriptor)
  10195.      Value:     <number>
  10196.      Initial:   undefined
  10197.      Media:     visual
  10198.  
  10199. This is the descriptor for the horizontal stem width of the font. If the
  10200. value is undefined, the descriptor is not used for matching. If this
  10201. descriptor is used, the 'units-per-em' descriptor must also be used.
  10202.  
  10203. 'slope' (Descriptor)
  10204.      Value:     <number>
  10205.      Initial:   0
  10206.      Media:     visual
  10207.  
  10208. This is the descriptor for the vertical stroke angle of the font.
  10209.  
  10210. 'cap-height' (Descriptor)
  10211.      Value:     <number>
  10212.      Initial:   undefined
  10213.      Media:     visual
  10214.  
  10215. This is the descriptor for the number of the height of uppercase glyphs of
  10216. the font. If the value is undefined, the descriptor is not used for
  10217. matching. If this descriptor is used, the 'units-per-em' descriptor must
  10218. also be used.
  10219.  
  10220. 'x-height' (Descriptor)
  10221.      Value:     <number>
  10222.      Initial:   undefined
  10223.      Media:     visual
  10224.  
  10225. This is the descriptor for the height of lowercase glyphs of the font. If
  10226. the value is undefined, the descriptor is not used for matching. If this
  10227. descriptor is used, the 'units-per-em' descriptor must also be used. This
  10228. descriptor can be very useful when using the 'font-size-adjust' property,
  10229. because computation of the z value of candidate fonts requires both the font
  10230. size and the x-height; it is therefore recommended to include this
  10231. descriptor.
  10232.  
  10233. 'ascent' (Descriptor)
  10234.      Value:     <number>
  10235.      Initial:   undefined
  10236.      Media:     visual
  10237.  
  10238. This is the descriptor for the maximum unaccented height of the font. If the
  10239. value is undefined, the descriptor is not used for matching. If this
  10240. descriptor is used, the 'units-per-em' descriptor must also be used.
  10241.  
  10242. 'descent' (Descriptor)
  10243.      Value:     <number>
  10244.      Initial:   undefined
  10245.      Media:     visual
  10246.  
  10247. This is the descriptor for the Maximum unaccented depth of the font. If the
  10248. value is undefined, the descriptor is not used for matching. If this
  10249. descriptor is used, the 'units-per-em' descriptor must also be used.
  10250.  
  10251. 15.3.7 Descriptors for Synthesis: 'widths', 'bbox' and 'definition-src'
  10252.  
  10253. Synthesizing a font means, at minimum, matching the width metrics of the
  10254. specified font. Therefore, for synthesis, this metric information must be
  10255. available. Similarly, progressive rendering requires width metrics in order
  10256. to avoid reflow of the content when the actual font has been loaded.
  10257. Although the following descriptors are optional for a CSS2 definition, some
  10258. are required if synthesizing (or reflow-free progressive rendering) is
  10259. desired by the author. Should the actual font become available, the
  10260. substitute should be replaced by the actual font. Any of these descriptors
  10261. that are present will be used to provide a better or faster approximation of
  10262. the intended font.
  10263.  
  10264. Of these descriptors, the most important are the 'widths' descriptor and
  10265. 'bbox' which are used to prevent text reflow should the actual font become
  10266. available. In addition, the descriptors in the set of descriptors used for
  10267. matching can be used to provide a better synthesis of the actual font
  10268. appearance.
  10269.  
  10270. 'widths' (Descriptor)
  10271.      Value:     [<urange> ]? [<number> ]+ [,[<urange> ]? <number> ]+]
  10272.      Initial:   undefined
  10273.      Media:     visual
  10274.  
  10275. This is the descriptor for the glyph widths. The value is a comma-separated
  10276. list of <urange> values each followed by one or more glyph widths. If this
  10277. descriptor is used, the 'units-per-em' descriptor must also be used.
  10278.  
  10279. If the <urange> is omitted, a range of U+0-7FFFFFFF is assumed which covers
  10280. all characters and their glyphs. If not enough glyph widths are given, the
  10281. last in the list is replicated to cover that urange. If too many widths are
  10282. provided, the extras are ignored.
  10283.  
  10284. Example(s):
  10285.  
  10286. For example:
  10287.  
  10288. widths: U+4E00-4E1F 1736 1874 1692
  10289. widths: U+1A?? 1490, U+215? 1473 1838 1927 1684 1356 1792
  10290.     1815 1848 1870 1492 1715 1745 1584 1992 1978 1770
  10291.  
  10292. In the first example a range of 32 characters is given, from 4E00 to 4E1F.
  10293. The glyph corresponding to the first character (4E00) has a width of 1736,
  10294. the second has a width of 1874 and the third, 1692. Because not enough
  10295. widths have been provided, the last width replicates to cover the rest of
  10296. the specified range. The second example sets a single width, 1490, for an
  10297. entire range of 256 glyphs and then explicit widths for a range of 16
  10298. glyphs.
  10299.  
  10300. This descriptor cannot describe multiple glyphs corresponding to a single
  10301. character, or ligatures of multiple characters. Thus, this descriptor can
  10302. only be used for scripts that do not have contextual forms or mandatory
  10303. ligatures. It is nevertheless useful in those situations. Scripts that
  10304. require a one-to-many or many-to-many mapping of characters to glyphs cannot
  10305. at present use this descriptor to enable font synthesis although they can
  10306. still use font downloading or intelligent matching.
  10307.  
  10308. 'bbox' (Descriptor)
  10309.      Value:     <number>, <number>, <number>, <number>
  10310.      Initial:   undefined
  10311.      Media:     visual
  10312.  
  10313. This is the descriptor for the maximal bounding box of the font. The value
  10314. is a comma-separated list of exactly four numbers specifying, in order, the
  10315. lower left x, lower left y, upper right x, and upper right y of the bounding
  10316. box for the complete font.
  10317.  
  10318. 'definition-src' (Descriptor)
  10319.      Value:     <uri>
  10320.      Initial:   undefined
  10321.      Media:     visual
  10322.  
  10323. The font descriptors may either be within the font definition in the style
  10324. sheet, or may be provided within a separate font definition resource
  10325. identified by a URI. The latter approach can reduce network traffic when
  10326. multiple style sheets reference the same fonts.
  10327.  
  10328. 15.3.8 Descriptors for Alignment: 'baseline', 'centerline', 'mathline', and
  10329. 'topline'
  10330.  
  10331. These optional descriptors are used to align runs of different scripts with
  10332. one another.
  10333.  
  10334. 'baseline' (Descriptor)
  10335.      Value:     <number>
  10336.      Initial:   0
  10337.      Media:     visual
  10338.  
  10339. This is the descriptor for the lower baseline of a font. If this descriptor
  10340. is given a non-default (non-zero) value, the 'units-per-em' descriptor must
  10341. also be used.
  10342.  
  10343. 'centerline' (Descriptor)
  10344.      Value:     <number>
  10345.      Initial:   undefined
  10346.      Media:     visual
  10347.  
  10348. This is the descriptor for the central baseline of a font. If the value is
  10349. undefined, the UA may employ various heuristics such as the midpoint of the
  10350. ascent and descent values. If this descriptor is used, the 'units-per-em'
  10351. descriptor must also be used.
  10352.  
  10353. 'mathline' (Descriptor)
  10354.      Value:     <number>
  10355.      Initial:   undefined
  10356.      Media:     visual
  10357.  
  10358. This is the descriptor for the mathematical baseline of a font. If
  10359. undefined, the UA may use the center baseline. If this descriptor is used,
  10360. the 'units-per-em' descriptor must also be used.
  10361.  
  10362. 'topline' (Descriptor)
  10363.      Value:     <number>
  10364.      Initial:   undefined
  10365.      Media:     visual
  10366.  
  10367. This is the descriptor for the top baseline of a font. If undefined, the UA
  10368. may use an approximate value such as the ascent. If this descriptor is used,
  10369. the 'units-per-em' descriptor must also be used.
  10370.  
  10371. 15.3.9 Examples
  10372.  
  10373. Example(s):
  10374.  
  10375. Given the following list of fonts:
  10376.  Swiss 721 light     light & light italic
  10377.  Swiss 721           roman, bold, italic, bold italic
  10378.  Swiss 721 medium    medium & medium italic
  10379.  Swiss 721 heavy     heavy & heavy italic
  10380.  Swiss 721 black     black, black italic, & black #2
  10381.  Swiss 721 Condensed roman, bold, italic, bold italic
  10382.  Swiss 721 Expanded  roman, bold, italic, bold italic
  10383.  
  10384. The following font descriptions could be used to make them available for
  10385. download.
  10386.  
  10387. @font-face {
  10388.     font-family: "Swiss 721";
  10389.     src: url("swiss721lt.pfr"); /* Swiss 721 light */
  10390.     font-style: normal, italic;
  10391.     font-weight: 200;
  10392. }
  10393. @font-face {
  10394.     font-family: "Swiss 721";
  10395.     src: url("swiss721.pfr"); /* The regular Swiss 721 */
  10396. }
  10397. @font-face {
  10398.     font-family: "Swiss 721";
  10399.     src: url("swiss721md.pfr"); /* Swiss 721 medium */
  10400.     font-style: normal, italic;
  10401.     font-weight: 500;
  10402. }
  10403. @font-face {
  10404.     font-family: "Swiss 721";
  10405.     src: url("swiss721hvy.pfr"); /* Swiss 721 heavy */
  10406.     font-style: normal, italic;
  10407.     font-weight: 700;
  10408. }
  10409. @font-face {
  10410.     font-family: "Swiss 721";
  10411.     src: url("swiss721blk.pfr"); /* Swiss 721 black */
  10412.     font-style: normal, italic;
  10413.     font-weight: 800,900; /* note the interesting problem that
  10414.                                the 900 weight italic doesn't exist */
  10415. }
  10416. @font-face {
  10417.     font-family: "Swiss 721";
  10418.     src: url(swiss721.pfr); /* The condensed Swiss 721 */
  10419.     font-stretch: condensed;
  10420. }
  10421. @font-face {
  10422.     font-family: "Swiss 721";
  10423.     src: url(swiss721.pfr); /* The expanded Swiss 721 */
  10424.     font-stretch: expanded;
  10425. }
  10426.  
  10427. 15.4 Font Characteristics
  10428.  
  10429. 15.4.1 Introducing Font Characteristics
  10430.  
  10431. In this section are listed the font characteristics that have been found
  10432. useful for client-side font matching, synthesis, and download for
  10433. heterogeneous platforms accessing the Web. The data may be useful for any
  10434. medium that needs to use fonts on the Web by some other means than physical
  10435. embedding of the font data inside the medium.
  10436.  
  10437. These characteristics are used to characterize fonts. They are not specific
  10438. to CSS, or to style sheets. In CSS, each characteristic is described by a
  10439. font descriptor. These characteristics could also be mapped onto VRML nodes,
  10440. or CGM Application Structures, or a Java API, or alternative style sheet
  10441. languages. Fonts retrieved by one medium and stored in a proxy cache could
  10442. be re-used by another medium, saving download time and network bandwidth, if
  10443. a common system of font characteristics are used throughout.
  10444.  
  10445. A non-exhaustive list of examples of such media includes:
  10446.  
  10447.    * 2-D vector formats
  10448.         o Computer Graphics Metafile
  10449.         o Simple Vector Format
  10450.    * 3-D graphics formats
  10451.         o VRML
  10452.         o 3DMF
  10453.    * Object embedding technologies
  10454.         o Java
  10455.         o Active-X
  10456.         o Obliq
  10457.  
  10458. 15.4.2 Full font name
  10459.  
  10460. This is the full name of a particular face of a font family. It typically
  10461. includes a variety of non-standardized textual qualifiers or adornments
  10462. appended to the font family name. It may also include a foundry name or
  10463. abbreviation, often prepended to the font family name. It is only used to
  10464. refer to locally installed fonts, because the format of the adorned name can
  10465. vary from platform to platform. It must be quoted.
  10466.  
  10467. For example, the font family name of the TrueType font and the PostScript
  10468. name may differ in the use of space characters, punctuation, and in the
  10469. abbreviation of some words (e.g., to meet various system or printer
  10470. interpreter constraints on length of names). For example, spaces are not
  10471. allow in a PostScript name, but are common in full font names. The TrueType
  10472. name table can also contain the PostScript name, which has no spaces.
  10473.  
  10474. The name of the font definition is important because it is the link to any
  10475. locally installed fonts. It is important that the name be robust, both with
  10476. respect to platform and application independence. For this reason, the name
  10477. should be one that is not application- or language-specific.
  10478.  
  10479. The ideal solution would be to have a name that uniquely identifies each
  10480. collection of font data. This name does not exist in current practice for
  10481. font data. Fonts with the same face name can vary over a number of
  10482. descriptors. Some of these descriptors, such as different complements of
  10483. glyphs in the font, may be insignificant if the needed glyphs are in the
  10484. font. Other descriptors, such as different width metrics, make fonts with
  10485. the same name incompatible. It does not seem possible to define a rule that
  10486. will always identify incompatibilities, but will not prevent the use of a
  10487. perfectly suitable local copy of the font data with a given name. Therefore,
  10488. only the range of ISO 10646 characters will be used to qualify matches for
  10489. the font face name.
  10490.  
  10491. Since a prime goal of the font face name in the font definition is to allow
  10492. a user agent to determine when there is a local copy of the specified font
  10493. data, the font face name must be a name that will be in all legitimate
  10494. copies of the font data. Otherwise, unnecessary Web traffic may be generated
  10495. due to missed matches for the local copy.
  10496.  
  10497. 15.4.3 Coordinate units on the em square
  10498.  
  10499. Certain values, such as width metrics, are expressed in units that are
  10500. relative to an abstract square whose height is the intended distance between
  10501. lines of type in the same type size. This square is called the em square and
  10502. it is the design grid on which the glyph outlines are defined. The value of
  10503. this descriptor specifies how many units the EM square is divided into.
  10504. Common values are for example 250 (Intellifont), 1000 (Type 1) and 2048
  10505. (TrueType, TrueType GX and OpenType).
  10506.  
  10507. If this value is not specified, it becomes impossible to know what any font
  10508. metrics mean. For example, one font has lowercase glyphs of height 450;
  10509. another has smaller ones of height 890! The numbers are actually fractions;
  10510. the first font has 450/1000 and the second has 890/2048 which is indeed
  10511. smaller.
  10512.  
  10513. 15.4.4 Central Baseline
  10514.  
  10515. This gives the position in the em square of the central baseline. The
  10516. central baseline is used by ideographic scripts for alignment, just as the
  10517. bottom baseline is used for Latin, Greek, and Cyrillic scripts.
  10518.  
  10519. 15.4.5 Font Encoding
  10520.  
  10521. Either explicitly or implicitly, each font has a table associated with it,
  10522. the font encoding table, that tells what character each glyph represents.
  10523. This table is also referred to as an encoding vector.
  10524.  
  10525. In fact, many fonts contain several glyphs for the same character. Which of
  10526. those glyphs should be used depends either on the rules of the language, or
  10527. on the preference of the designer.
  10528.  
  10529. In Arabic, for example, all letters have four (or two) different shapes,
  10530. depending on whether the letter is used at the start of a word, in the
  10531. middle, at the end, or in isolation. It is the same character in all cases,
  10532. and thus there is only one character in the source document, but when
  10533. printed, it looks different each time.
  10534.  
  10535. There are also fonts that leave it to the graphic designer to choose from
  10536. among various alternative shapes provided. Unfortunately, CSS2 doesn't yet
  10537. provide the means to select those alternatives. Currently, it is always the
  10538. default shape that is chosen from such fonts.
  10539.  
  10540. 15.4.6 Font family name
  10541.  
  10542. This specifies the family name portion of the font face name. For example,
  10543. the family name for Helvetica-Bold is Helvetica and the family name of ITC
  10544. Stone Serif Semibold Italic is ITC Stone Serif. Some systems treat
  10545. adornments relating to condensed or expanded faces as if they were part of
  10546. the family name.
  10547.  
  10548. 15.4.7 Glyph widths
  10549.  
  10550. This is a list of widths, on the design grid, for the glyph corresponding to
  10551. each character. The list is ordered by ISO10646 code point. Widths cannot
  10552. usefully be specified when more than one glyph maps to the same character or
  10553. when there are mandatory ligatures.
  10554.  
  10555. 15.4.8 Horizontal stem width
  10556.  
  10557. This value refers to the dominant stem of the font. There may be two or more
  10558. designed widths. For example, the main vertical stems of Roman characters
  10559. will differ from the thin stems on serifed "M" and "N", plus there may be
  10560. different widths for uppercase and lowercase characters in the same font.
  10561. Also, either by design or by error, all stems may have slightly different
  10562. widths.
  10563.  
  10564. 15.4.9 Height of uppercase glyphs
  10565.  
  10566. This measurement is the y-coordinate of the top of flat uppercase letters in
  10567. Latin, Greek, and Cyrillic scripts, measured from the baseline. This
  10568. descriptor is not necessarily useful for fonts that do not contain any
  10569. glyphs from these scripts.
  10570.  
  10571. 15.4.10 Height of lowercase glyphs
  10572.  
  10573. This measurement is the y-coordinate of the top of unaccented, non-ascending
  10574. lowercase letters in Latin, Greek and Cyrillic scripts, measured from the
  10575. baseline. Flat-topped letters are used, ignoring any optical correction
  10576. zone. This is usually used as a ratio of lowercase to uppercase heights as a
  10577. means to compare font families.
  10578.  
  10579. [Illustration of x-height]
  10580.  
  10581. This descriptor is not useful for fonts that do not contain any glyphs from
  10582. these scripts. Since the heights of lowercase and uppercase letters are
  10583. often expressed as a ratio for comparing different fonts, it may be useful
  10584. to set both the lowercase and uppercase heights to the same value for
  10585. unicameral scripts such as Hebrew, where for mixed Latin and Hebrew text,
  10586. the Hebrew characters are typically set at a height midway between the
  10587. uppercase and lowercase heights of the Latin font.
  10588.  
  10589. [Height of Hebrew characters]
  10590.  
  10591. 15.4.11 Lower Baseline
  10592.  
  10593. This gives the position in the em square of the lower baseline. The lower
  10594. baseline is used by Latin, Greek, and Cyrillic scripts for alignment, just
  10595. as the upper baseline is used for Sanscrit-derived scripts.
  10596.  
  10597. 15.4.12 Mathematical Baseline
  10598.  
  10599. This gives the position in the em square of the mathematical baseline. The
  10600. mathematical baseline is used by mathematical symbols for alignment, just as
  10601. the lower baseline is used for Latin, Greek, and Cyrillic scripts.
  10602.  
  10603. 15.4.13 Maximal bounding box
  10604.  
  10605. The maximal bounding box is the smallest rectangle enclosing the shape that
  10606. results if all glyphs in the font are placed with their origins coincident,
  10607. and then painted.
  10608.  
  10609. If a dynamically downloadable font has been generated by subsetting a parent
  10610. font, the bbox should be that of the parent font.
  10611.  
  10612. 15.4.14 Maximum unaccented height
  10613.  
  10614. This measurement, on the em square, is from the baseline to the highest
  10615. point reached by any glyph, excluding any accents or diacritical marks.
  10616.  
  10617. [Diagram showing several glyphs and the maximum unaccented height]
  10618.  
  10619. 15.4.15 Maximum unaccented depth
  10620.  
  10621. This measurement, on the em square, is from the baseline to the lowest point
  10622. reached by any glyph, excluding any accents or diacritical marks.
  10623.  
  10624. [Diagram showing several glyphs and the maximum unaccented depth]
  10625.  
  10626. 15.4.16 Panose-1 number
  10627.  
  10628. Panose-1 is an industry standard TrueType font classification and matching
  10629. technology. The PANOSE system consists of a set of ten numbers that
  10630. categorize the key attributes of a Latin typeface, a classification
  10631. procedure for creating those numbers, and Mapper software that determines
  10632. the closest possible font match given a set of typefaces. The system could,
  10633. with modification, also be used for Greek and Cyrillic, but is not suitable
  10634. for unicameral and ideographic scripts (Hebrew, Armenian, Arabic,
  10635. Chinese/Japanese/Korean).
  10636.  
  10637. 15.4.17 Range of ISO 10646 characters
  10638.  
  10639. This indicates the glyph repertoire of the font, relative to ISO 10646
  10640. (Unicode). Since this is sparse (most fonts do not cover the whole of ISO
  10641. 10646) this descriptor lists blocks or ranges that do have some coverage (no
  10642. promise is made of complete coverage) and is used to eliminate unsuitable
  10643. fonts (ones that will not have the required glyphs). It does not indicate
  10644. that the font definitely has the required glyphs, only that it is worth
  10645. downloading and looking at the font. See [ISO10646] for information about
  10646. useful documents.
  10647.  
  10648. This method is extensible to future allocation of characters in Unicode,
  10649. without change of syntax and without invalidating existing content.
  10650.  
  10651. Font formats that do not include this information, explicitly or indirectly,
  10652. may still use this characteristic, but the value must be supplied by the
  10653. document or style sheet author.
  10654.  
  10655. There are other classifications into scripts, such as the Monotype system
  10656. (see [MONOTYPE]) and a proposed ISO script system. These are not readily
  10657. extensible.
  10658.  
  10659. Because of this, classification of glyph repertoires by the range of ISO
  10660. 10646 characters that may be represented with a particular font is used in
  10661. this specification. This system is extensible to cover any future
  10662. allocation.
  10663.  
  10664. 15.4.18 Top Baseline
  10665.  
  10666. This gives the position in the em square of the top baseline. The top
  10667. baseline is used by Sanscrit-derived scripts for alignment, just as the
  10668. bottom baseline is used for Latin, Greek, and Cyrillic scripts.
  10669.  
  10670. 15.4.19 Vertical stem width
  10671.  
  10672. This is the width of vertical (or near-vertical) stems of glyphs. This
  10673. information is often tied to hinting, and may not be directly accessible in
  10674. some font formats. The measurement should be for the dominant vertical stem
  10675. in the font because there might be different groupings of vertical stems
  10676. (e.g., one main one, and one lighter weight one as for an uppercase M or N).
  10677.  
  10678. 15.4.20 Vertical stroke angle
  10679.  
  10680. This is the angle, in degrees counterclockwise from the vertical, of the
  10681. dominant vertical strokes of the font. The value is negative for fonts that
  10682. slope to the right, as almost all italic fonts do. This descriptor may also
  10683. be specified for oblique fonts, slanted fonts, script fonts, and in general
  10684. for any font whose vertical strokes are not precisely vertical. A non-zero
  10685. value does not of itself indicate an italic font.
  10686.  
  10687. 15.5 Font matching algorithm
  10688.  
  10689. This specification extends the algorithm given in the CSS1 specification.
  10690. This algorithm reduces down to the algorithm in the CSS1 specification when
  10691. the author and reader style sheets do not contain any @font-face rules.
  10692.  
  10693. Matching of descriptors to font faces must be done carefully. The
  10694. descriptors are matched in a well-defined order to insure that the results
  10695. of this matching process are as consistent as possible across UAs (assuming
  10696. that the same library of font faces and font descriptions is presented to
  10697. each of them). This algorithm may be optimized, provided that an
  10698. implementation behaves as if the algorithm had been followed exactly.
  10699.  
  10700.   1. The user agent makes (or accesses) a database of relevant font-face
  10701.      descriptors of all the fonts of which the UA is aware. If there are two
  10702.      fonts with exactly the same descriptors, one of them is ignored. The UA
  10703.      may be aware of a font because:
  10704.         o it has been installed locally
  10705.         o it is declared using an @font-face rule in one of the style sheets
  10706.           linked to or contained in the current document
  10707.         o it is used in the UA default style sheet, which conceptually
  10708.           exists in all UAs and is considered to have full @font-face rules
  10709.           for all fonts which the UA will use for default presentation, plus
  10710.           @font-face rules for the five special generic font families (see
  10711.           'font-family') defined in CSS2
  10712.   2. At a given element and for each character in that element, the UA
  10713.      assembles the font properties applicable to that element. Using the
  10714.      complete set of properties, the UA uses the 'font-family' descriptor to
  10715.      choose a tentative font family. Thus, matching on a family name will
  10716.      succeed before matching on some other descriptor. The remaining
  10717.      properties are tested against the family according to the matching
  10718.      criteria described with each descriptor. If there are matches for all
  10719.      the remaining properties, then that is the matching font face for the
  10720.      given element.
  10721.   3. If there is no matching font face within the 'font-family' being
  10722.      processed by step 2, UAs that implement intelligent matching may
  10723.      proceed to examine other descriptors such as x-height, glyph widths,
  10724.      and panose-1 to identify a different tentative font family. If there
  10725.      are matches for all the remaining descriptors, then that is the
  10726.      matching font face for the given element. The 'font-family' descriptor
  10727.      that is reflected into the CSS2 properties is the font family that was
  10728.      requested, not whatever name the intelligently matched font may have.
  10729.      UAs that do not implement intelligent matching are considered to fail
  10730.      at this step.
  10731.   4. If there is no matching font face within the 'font-family' being
  10732.      processed by step 3, UAs that implement font downloading may proceed to
  10733.      examine the 'src' descriptor of the tentative font face identified in
  10734.      step 2 or 3 to identify a network resource that is available, and of
  10735.      the correct format. If there are matches for all the remaining
  10736.      descriptors, then that is the matching font face for the given element
  10737.      and the UA may attempt to download this font resource. The UA may
  10738.      choose to block on this download or may choose to proceed to the next
  10739.      step while the font downloads. UAs that do not implement font download,
  10740.      or are not connected to a network, or where the user preferences have
  10741.      disabled font download, or where the requested resource is unavailable
  10742.      for whatever reason, or where the downloaded font cannot be used for
  10743.      whatever reason, are considered to fail at this step.
  10744.   5. If there is no matching font face within the 'font-family' being
  10745.      processed by step 3, UAs that implement font synthesis may proceed to
  10746.      examine other descriptors such as 'x-height', glyph widths, and
  10747.      'panose-1' to identify a different tentative font family for synthesis.
  10748.      If there are matches for all the remaining descriptors, then that is
  10749.      the matching font face for the given element and synthesis of the faux
  10750.      font may begin. UAs that do not implement font synthesis are considered
  10751.      to fail at this step.
  10752.   6. If all of steps 3, 4 and 5 fail, and if there is a next alternative
  10753.      'font-family' in the font set, then repeat from step 2 with the next
  10754.      alternative 'font-family'.
  10755.   7. If there is a matching font face, but it doesn't contain glyph(s) for
  10756.      the current character(s), and if there is a next alternative
  10757.      'font-family' in the font sets, then repeat from step 2 with the next
  10758.      alternative 'font-family'. The 'unicode-range' descriptor may be used
  10759.      to rapidly eliminate from consideration those font faces that do not
  10760.      have the correct glyphs. If the 'unicode-range' descriptor indicates
  10761.      that a font contains some glyphs in the correct range, it may be
  10762.      examined by the UA to see if it has that particular one.
  10763.   8. If there is no font within the family selected in 2, then use the
  10764.      inherited or UA-dependent 'font-family' value and repeat from step 2,
  10765.      using the best match that can be obtained within this font. If a
  10766.      particular character cannot be displayed using this font, the UA should
  10767.      indicate that a character is not being displayed (for example, using
  10768.      the 'missing character' glyph).
  10769.   9. UAs that implement progressive rendering and have pending font
  10770.      downloads may, once download is successful, use the downloaded font as
  10771.      a font family. If the downloaded font is missing some glyphs that the
  10772.      temporary progressive font did contain, the downloaded font is not used
  10773.      for that character and the temporary font continues to be used.
  10774.  
  10775. Note. The above algorithm can be optimized to avoid having to revisit the
  10776. CSS2 properties for each character.
  10777.  
  10778. The per-descriptor matching rules from (2) above are as follows:
  10779.  
  10780.   1. 'font-style' is tried first. 'italic' will be satisfied if there is
  10781.      either a face in the UA's font database labeled with the CSS keyword
  10782.      'italic' (preferred) or 'oblique'. Otherwise the values must be matched
  10783.      exactly or font-style will fail.
  10784.   2. 'font-variant' is tried next. 'normal' matches a font not labeled as
  10785.      'small-caps'; 'small-caps' matches (1) a font labeled as 'small-caps',
  10786.      (2) a font in which the small caps are synthesized, or (3) a font where
  10787.      all lowercase letters are replaced by uppercase letters. A small-caps
  10788.      font may be synthesized by electronically scaling uppercase letters
  10789.      from a normal font.
  10790.   3. 'font-weight' is matched next, it will never fail. (See 'font-weight'
  10791.      below.)
  10792.   4. 'font-size' must be matched within a UA-dependent margin of tolerance.
  10793.      (Typically, sizes for scalable fonts are rounded to the nearest whole
  10794.      pixel, while the tolerance for bitmapped fonts could be as large as
  10795.      20%.) Further computations, e.g., by 'em' values in other properties,
  10796.      are based on the 'font-size' value that is used, not the one that is
  10797.      specified.
  10798.  
  10799. 15.5.1 Mapping font weight values to font names
  10800.  
  10801. The 'font-weight' property values are given on a numerical scale in which
  10802. the value '400' (or 'normal') corresponds to the "normal" text face for that
  10803. family. The weight name associated with that face will typically be Book,
  10804. Regular, Roman, Normal or sometimes Medium.
  10805.  
  10806. The association of other weights within a family to the numerical weight
  10807. values is intended only to preserve the ordering of weights within that
  10808. family. User agents must map names to values in a way that preserves visual
  10809. order; a face mapped to a value must not be lighter than faces mapped to
  10810. lower values. There is no guarantee on how a user agent will map font faces
  10811. within a family to weight values. However, the following heuristics tell how
  10812. the assignment is done in typical cases:
  10813.  
  10814.    * If the font family already uses a numerical scale with nine values (as
  10815.      e.g., OpenType does), the font weights should be mapped directly.
  10816.    * If there is both a face labeled Medium and one labeled Book, Regular,
  10817.      Roman or Normal, then the Medium is normally assigned to the '500'.
  10818.    * The font labeled "Bold" will often correspond to the weight value
  10819.      '700'.
  10820.    * If there are fewer then 9 weights in the family, the default algorithm
  10821.      for filling the "holes" is as follows. If '500' is unassigned, it will
  10822.      be assigned the same font as '400'. If any of the values '600', '700',
  10823.      '800', or '900' remains unassigned, they are assigned to the same face
  10824.      as the next darker assigned keyword, if any, or the next lighter one
  10825.      otherwise. If any of '300', '200', or '100' remains unassigned, it is
  10826.      assigned to the next lighter assigned keyword, if any, or the next
  10827.      darker otherwise.
  10828.  
  10829. There is no guarantee that there will be a darker face for each of the
  10830. 'font-weight' values; for example, some fonts may have only a normal and a
  10831. bold face, others may have eight different face weights.
  10832.  
  10833. The following two examples show typical mappings.
  10834.  
  10835. Assume four weights in the "Rattlesnake" family, from lightest to darkest:
  10836. Regular, Medium, Bold, Heavy.
  10837.  
  10838.          First example of font-weight mapping
  10839.  
  10840.     Available faces    Assignments  Filling the holes
  10841.  "Rattlesnake Regular" 400          100, 200, 300
  10842.  "Rattlesnake Medium"  500
  10843.  "Rattlesnake Bold"    700          600
  10844.  "Rattlesnake Heavy"   800          900
  10845.  
  10846. Assume six weights in the "Ice Prawn" family: Book, Medium, Bold, Heavy,
  10847. Black, ExtraBlack. Note that in this instance the user agent has decided not
  10848. to assign a numeric value to "Example2 ExtraBlack".
  10849.  
  10850.          Second example of font-weight mapping
  10851.  
  10852.     Available faces     Assignments  Filling the holes
  10853.  "Ice Prawn Book"       400          100, 200, 300
  10854.  "Ice Prawn Medium"     500
  10855.  "Ice Prawn Bold"       700          600
  10856.  "Ice Prawn Heavy"      800
  10857.  "Ice Prawn Black"      900
  10858.  "Ice Prawn ExtraBlack" (none)
  10859.  
  10860. 15.5.2 Examples of font matching
  10861.  
  10862. Example(s):
  10863.  
  10864. The following example defines a specific font face, Alabama Italic. A panose
  10865. font description and source URI for retrieving a truetype server font are
  10866. also provided. Font-weight and font-style descriptors are provided to
  10867. describe the font. The declaration says that the weight will also match any
  10868. request in the range 300 to 500. The font family is Alabama and the adorned
  10869. font name is Alabama Italic.
  10870.  
  10871. @font-face {
  10872.   src: local("Alabama Italic"),
  10873.        url(http://www.fonts.org/A/alabama-italic) format("truetype");
  10874.   panose-1: 2 4 5 2 5 4 5 9 3 3;
  10875.   font-family: Alabama, serif;
  10876.   font-weight:   300, 400, 500;
  10877.   font-style:  italic, oblique;
  10878. }
  10879.  
  10880. Example(s):
  10881.  
  10882. The next example defines a family of fonts. A single URI is provided for
  10883. retrieving the font data. This data file will contain multiple styles and
  10884. weights of the named font. Once one of these @font-face definitions has been
  10885. dereferenced, the data will be in the UA cache for other faces that use the
  10886. same URI.
  10887.  
  10888. @font-face {
  10889.   src: local("Helvetica Medium"),
  10890.        url(http://www.fonts.org/sans/Helvetica_family) format("truedoc");
  10891.   font-family: "Helvetica";
  10892.   font-style: normal
  10893. }
  10894. @font-face {
  10895.   src: local("Helvetica Oblique"),
  10896.        url("http://www.fonts.org/sans/Helvetica_family") format("truedoc");
  10897.   font-family: "Helvetica";
  10898.   font-style: oblique;
  10899.   slope: -18
  10900. }
  10901.  
  10902. Example(s):
  10903.  
  10904. The following example groups three physical fonts into one virtual font with
  10905. extended coverage. In each case, the adorned font name is given in the src
  10906. descriptor to allow locally installed versions to be preferentially used if
  10907. available. A fourth rule points to a font with the same coverage, but
  10908. contained in a single resource.
  10909.  
  10910. @font-face {
  10911.   font-family: Excelsior;
  10912.   src: local("Excelsior Roman"), url("http://site/er") format("intellifont");
  10913.   unicode-range: U+??; /* Latin-1 */
  10914. }
  10915. @font-face {
  10916.   font-family: Excelsior;
  10917.   src: local("Excelsior EastA Roman"), url("http://site/ear") format("intellifont");
  10918.   unicode-range: U+100-220; /* Latin Extended A and B */
  10919. }
  10920. @font-face {
  10921.   font-family: Excelsior;
  10922.   src: local("Excelsior Cyrillic Upright"), url("http://site/ecr") format("intellifont");
  10923.   unicode-range: U+4??; /* Cyrillic */
  10924. }
  10925. @font-face {
  10926.   font-family: Excelsior;
  10927.   src: url("http://site/excels") format("truedoc");
  10928.   unicode-range: U+??,U+100-220,U+4??;
  10929. }
  10930.  
  10931. Example(s):
  10932.  
  10933. This next example might be found in a UA's default style sheet. It
  10934. implements the CSS2 generic font family, serif by mapping it to a wide
  10935. variety of serif fonts that might exist on various platforms. No metrics are
  10936. given since these vary among the possible alternatives.
  10937.  
  10938. @font-face {
  10939.   src: local("Palatino"),
  10940.           local("Times New Roman"),
  10941.           local("New York"),
  10942.           local("Utopia"),
  10943.           url("http://somewhere/free/font");
  10944.   font-family: serif;
  10945.   font-weight: 100, 200, 300, 400, 500;
  10946.   font-style: normal;
  10947.   font-variant: normal;
  10948.   font-size: all
  10949. }
  10950.  
  10951.   ------------------------------------------------------------------------
  10952.   ------------------------------------------------------------------------
  10953.  
  10954.                                    16 Text
  10955.  
  10956. Contents
  10957.  
  10958.    * 16.1 Indentation: the 'text-indent' property
  10959.    * 16.2 Alignment: the 'text-align' property
  10960.    * 16.3 Decoration
  10961.         o 16.3.1 Underlining, overlining, striking, and blinking: the
  10962.           'text-decoration' property
  10963.         o 16.3.2 Text shadows: the 'text-shadow' property
  10964.    * 16.4 Letter and word spacing: the 'letter-spacing' and 'word-spacing'
  10965.      properties
  10966.    * 16.5 Capitalization: the 'text-transform' property
  10967.    * 16.6 Whitespace: the 'white-space' property
  10968.  
  10969. The properties defined in the following sections affect the visual
  10970. presentation of characters, spaces, words, and paragraphs.
  10971.  
  10972. 16.1 Indentation: the 'text-indent' property
  10973.  
  10974. 'text-indent'
  10975.      Value:         <length> | <percentage> | inherit
  10976.      Initial:       0
  10977.      Applies to:    block-level elements
  10978.      Inherited:     yes
  10979.      Percentages:   refer to width of containing block
  10980.      Media:         visual
  10981.  
  10982. This property specifies the indentation of the first line of text in a
  10983. block. More precisely, it specifies the indentation of the first box that
  10984. flows into the block's first line box. The box is indented with respect to
  10985. the left (or right, for right-to-left layout) edge of the line box. User
  10986. agents should render this indentation as blank space.
  10987.  
  10988. Values have the following meanings:
  10989.  
  10990. <length>
  10991.      The indentation is a fixed length.
  10992. <percentage>
  10993.      The indentation is a percentage of the containing block width.
  10994.  
  10995. The value of 'text-indent' may be negative, but there may be
  10996. implementation-specific limits.
  10997.  
  10998. Example(s):
  10999.  
  11000. The following example causes a '3em' text indent.
  11001.  
  11002.   P { text-indent: 3em }
  11003.  
  11004. 16.2 Alignment: the 'text-align' property
  11005.  
  11006. 'text-align'
  11007.      Value:         left | right | center | justify | <string> | inherit
  11008.      Initial:       depends on user agent and writing direction
  11009.      Applies to:    block-level elements
  11010.      Inherited:     yes
  11011.      Percentages:   N/A
  11012.      Media:         visual
  11013.  
  11014. This property describes how inline content of a block is aligned. Values
  11015. have the following meanings:
  11016.  
  11017. left, right, center, and justify
  11018.      Left, right, center, and double justify text, respectively.
  11019. <string>
  11020.      Specifies a string on which cells in a table column will align (see the
  11021.      section on horizontal alignment in a column for details and an
  11022.      example). This value applies only to table cells. If set on other
  11023.      elements, it will be treated as 'left' or 'right', depending on whether
  11024.      'direction' is 'ltr', or 'rtl', respectively.
  11025.  
  11026. A block of text is a stack of line boxes. In the case of 'left', 'right' and
  11027. 'center', this property specifies how the inline boxes within each line box
  11028. align with respect to the line box's left and right sides; alignment is not
  11029. with respect to the viewport. In the case of 'justify', the UA may stretch
  11030. the inline boxes in addition to adjusting their positions. (See also
  11031. 'letter-spacing' and 'word-spacing'.)
  11032.  
  11033. Example(s):
  11034.  
  11035. In this example, note that since 'text-align' is inherited, all block-level
  11036. elements inside the DIV element with 'class=center' will have their inline
  11037. content centered.
  11038.  
  11039. DIV.center { text-align: center }
  11040.  
  11041. Note. The actual justification algorithm used is user-agent and written
  11042. language dependent.
  11043.  
  11044. Conforming user agents may interpret the value 'justify' as 'left' or
  11045. 'right', depending on whether the element's default writing direction is
  11046. left-to-right or right-to-left, respectively.
  11047.  
  11048. 16.3 Decoration
  11049.  
  11050. 16.3.1 Underlining, overlining, striking, and blinking: the
  11051. 'text-decoration' property
  11052.  
  11053. 'text-decoration'
  11054.      Value:         none | [ underline || overline || line-through || blink
  11055.                     ] | inherit
  11056.      Initial:       none
  11057.      Applies to:    all elements
  11058.      Inherited:     no (see prose)
  11059.      Percentages:   N/A
  11060.      Media:         visual
  11061.  
  11062. This property describes decorations that are added to the text of an
  11063. element. If the property is specified for a block-level element, it affects
  11064. all inline-level descendants of the element. If it is specified for (or
  11065. affects) an inline-level element, it affects all boxes generated by the
  11066. element. If the element has no content or no text content (e.g., the IMG
  11067. element in HTML), user agents must ignore this property.
  11068.  
  11069. Values have the following meanings:
  11070.  
  11071. none
  11072.      Produces no text decoration.
  11073. underline
  11074.      Each line of text is underlined.
  11075. overline
  11076.      Each line of text has a line above it.
  11077. line-through
  11078.      Each line of text has a line through the middle
  11079. blink
  11080.      Text blinks (alternates between visible and invisible). Conforming user
  11081.      agents are not required to support this value.
  11082.  
  11083. The color(s) required for the text decoration should be derived from the
  11084. 'color' property value.
  11085.  
  11086. This property is not inherited, but descendant boxes of a block box should
  11087. be formatted with the same decoration (e.g., they should all be underlined).
  11088. The color of decorations should remain the same even if descendant elements
  11089. have different 'color' values.
  11090.  
  11091. Example(s):
  11092.  
  11093. In the following example for HTML, the text content of all A elements acting
  11094. as hyperlinks will be underlined:
  11095.  
  11096. A[href] { text-decoration: underline }
  11097.  
  11098. 16.3.2 Text shadows: the 'text-shadow' property
  11099.  
  11100. 'text-shadow'
  11101.      Value:         none | [<color> || <length> <length> <length>? ,]*
  11102.                     [<color> || <length> <length> <length>?] | inherit
  11103.      Initial:       none
  11104.      Applies to:    all elements
  11105.      Inherited:     no (see prose)
  11106.      Percentages:   N/A
  11107.      Media:         visual
  11108.  
  11109. This property accepts a comma-separated list of shadow effects to be applied
  11110. to the text of the element. The shadow effects are applied in the order
  11111. specified and may thus overlay each other, but they will never overlay the
  11112. text itself. Shadow effects do not alter the size of a box, but may extend
  11113. beyond its boundaries. The stack level of the shadow effects is the same as
  11114. for the element itself.
  11115.  
  11116. Each shadow effect must specify a shadow offset and may optionally specify a
  11117. blur radius and a shadow color.
  11118.  
  11119. A shadow offset is specified with two <length> values that indicate the
  11120. distance from the text. The first length value specifies the horizontal
  11121. distance to the right of the text. A negative horizontal length value places
  11122. the shadow to the left of the text. The second length value specifies the
  11123. vertical distance below the text. A negative vertical length value places
  11124. the shadow above the text.
  11125.  
  11126. A blur radius may optionally be specified after the shadow offset. The blur
  11127. radius is a length value that indicates the boundaries of the blur effect.
  11128. The exact algorithm for computing the blur effect is not specified.
  11129.  
  11130. A color value may optionally be specified before or after the length values
  11131. of the shadow effect. The color value will be used as the basis for the
  11132. shadow effect. If no color is specified, the value of the 'color' property
  11133. will be used instead.
  11134.  
  11135. Text shadows may be used with the :first-letter and :first-line
  11136. pseudo-elements.
  11137.  
  11138. Example(s):
  11139.  
  11140. The example below will set a text shadow to the right and below the
  11141. element's text. Since no color has been specified, the shadow will have the
  11142. same color as the element itself, and since no blur radius is specified, the
  11143. text shadow will not be blurred:
  11144.  
  11145. H1 { text-shadow: 0.2em 0.2em }
  11146.  
  11147. The next example will place a shadow to the right and below the element's
  11148. text. The shadow will have a 5px blur radius and will be red.
  11149.  
  11150. H2 { text-shadow: 3px 3px 5px red }
  11151.  
  11152. The next example specifies a list of shadow effects. The first shadow will
  11153. be to the right and below the element's text and will be red with no
  11154. blurring. The second shadow will overlay the first shadow effect, and it
  11155. will be yellow, blurred, and placed to the left and below the text. The
  11156. third shadow effect will be placed to the right and above the text. Since no
  11157. shadow color is specified for the third shadow effect, the value of the
  11158. element's 'color' property will be used:
  11159.  
  11160. H2 { text-shadow: 3px 3px red, yellow -3px 3px 2px, 3px -3px }
  11161.  
  11162. Example(s):
  11163.  
  11164. Consider this example:
  11165.  
  11166. SPAN.glow {
  11167.     background: white;
  11168.     color: white;
  11169.     text-shadow: black 0px 0px 5px;
  11170. }
  11171.  
  11172. Here, the 'background' and 'color' properties have the same value and the
  11173. 'text-shadow' property is used to create a "solar eclipse" effect:
  11174.  
  11175. [Solar eclipse effect]   [D]
  11176.  
  11177. Note. This property is not defined in CSS1. Some shadow effects (such as the
  11178. one in the last example) may render text invisible in UAs that only support
  11179. CSS1.
  11180.  
  11181. 16.4 Letter and word spacing: the 'letter-spacing' and 'word-spacing'
  11182. properties
  11183.  
  11184. 'letter-spacing'
  11185.      Value:         normal | <length> | inherit
  11186.      Initial:       normal
  11187.      Applies to:    all elements
  11188.      Inherited:     yes
  11189.      Percentages:   N/A
  11190.      Media:         visual
  11191.  
  11192. This property specifies spacing behavior between text characters. Values
  11193. have the following meanings:
  11194.  
  11195. normal
  11196.      The spacing is the normal spacing for the current font. This value
  11197.      allows the user agent to alter the space between characters in order to
  11198.      justify text.
  11199. <length>
  11200.      This value indicates inter-character space in addition to the default
  11201.      space between characters. Values may be negative, but there may be
  11202.      implementation-specific limits. User agents may not further increase or
  11203.      decrease the inter-character space in order to justify text.
  11204.  
  11205. Character spacing algorithms are user agent-dependent. Character spacing may
  11206. also be influenced by justification (see the 'text-align' property).
  11207.  
  11208. Example(s):
  11209.  
  11210. In this example, the space between characters in BLOCKQUOTE elements is
  11211. increased by '0.1em'.
  11212.  
  11213. BLOCKQUOTE { letter-spacing: 0.1em }
  11214.  
  11215. In the following example, the user agent is not permitted to alter
  11216. inter-character space:
  11217.  
  11218. BLOCKQUOTE { letter-spacing: 0cm }   /* Same as '0' */
  11219.  
  11220. When the resultant space between two characters is not the same as the
  11221. default space, user agents should not use ligatures.
  11222.  
  11223. Conforming user agents may consider the value of the 'letter-spacing'
  11224. property to be 'normal'.
  11225.  
  11226. 'word-spacing'
  11227.      Value:         normal | <length> | inherit
  11228.      Initial:       normal
  11229.      Applies to:    all elements
  11230.      Inherited:     yes
  11231.      Percentages:   N/A
  11232.      Media:         visual
  11233.  
  11234. This property specifies spacing behavior between words. Values have the
  11235. following meanings:
  11236.  
  11237. normal
  11238.      The normal inter-word space, as defined by the current font and/or the
  11239.      UA.
  11240. <length>
  11241.      This value indicates inter-word space in addition to the default space
  11242.      between words. Values may be negative, but there may be
  11243.      implementation-specific limits.
  11244.  
  11245. Word spacing algorithms are user agent-dependent. Word spacing is also
  11246. influenced by justification (see the 'text-align' property).
  11247.  
  11248. Example(s):
  11249.  
  11250. In this example, the word-spacing between each word in H1 elements is
  11251. increased by '1em'.
  11252.  
  11253. H1 { word-spacing: 1em }
  11254.  
  11255. Conforming user agents may consider the value of the 'word-spacing' property
  11256. to be 'normal'.
  11257.  
  11258. 16.5 Capitalization: the 'text-transform' property
  11259.  
  11260. 'text-transform'
  11261.      Value:         capitalize | uppercase | lowercase | none | inherit
  11262.      Initial:       none
  11263.      Applies to:    all elements
  11264.      Inherited:     yes
  11265.      Percentages:   N/A
  11266.      Media:         visual
  11267.  
  11268. This property controls capitalization effects of an element's text. Values
  11269. have the following meanings:
  11270.  
  11271. capitalize
  11272.      Puts the first character of each word in uppercase.
  11273. uppercase
  11274.      Puts all characters of each word in uppercase.
  11275. lowercase
  11276.      Puts all characters of each word in lowercase.
  11277. none
  11278.      No capitalization effects.
  11279.  
  11280. The actual transformation in each case is written language dependent. See
  11281. RFC 2070 ([RFC2070]) for ways to find the language of an element.
  11282.  
  11283. Conforming user agents may consider the value of 'text-transform' to be
  11284. 'none' for characters that are not from the Latin-1 repertoire and for
  11285. elements in languages for which the transformation is different from that
  11286. specified by the case-conversion tables of ISO 10646 ([ISO10646]).
  11287.  
  11288. Example(s):
  11289.  
  11290. In this example, all text in an H1 element is transformed to uppercase text.
  11291.  
  11292. H1 { text-transform: uppercase }
  11293.  
  11294. 16.6 Whitespace: the 'white-space' property
  11295.  
  11296. 'white-space'
  11297.      Value:         normal | pre | nowrap | inherit
  11298.      Initial:       normal
  11299.      Applies to:    block-level elements
  11300.      Inherited:     yes
  11301.      Percentages:   N/A
  11302.      Media:         visual
  11303.  
  11304. This property declares how whitespace inside the element is handled. Values
  11305. have the following meanings:
  11306.  
  11307. normal
  11308.      This value directs user agents to collapse sequences of whitespace, and
  11309.      break lines as necessary to fill line boxes. Additional line breaks may
  11310.      be created by occurrences of "\A" in generated content (e.g., for the
  11311.      BR element in HTML).
  11312. pre
  11313.      This value prevents user agents from collapsing sequences of
  11314.      whitespace. Lines are only broken at newlines in the source, or at
  11315.      occurrences of "\A" in generated content.
  11316. nowrap
  11317.      This value collapses whitespace as for 'normal', but suppresses line
  11318.      breaks within text except for those created by "\A" in generated
  11319.      content (e.g., for the BR element in HTML).
  11320.  
  11321. Example(s):
  11322.  
  11323. The following examples show what whitespace behavior is expected from the
  11324. PRE and P elements, and the "nowrap" attribute in HTML.
  11325.  
  11326. PRE        { white-space: pre }
  11327. P          { white-space: normal }
  11328. TD[nowrap] { white-space: nowrap }
  11329.  
  11330. Conforming user agents may ignore the 'white-space' property in author and
  11331. user style sheets but must specify a value for it in the default style
  11332. sheet.
  11333.   ------------------------------------------------------------------------
  11334.   ------------------------------------------------------------------------
  11335.  
  11336.                                   17 Tables
  11337.  
  11338. Contents
  11339.  
  11340.    * 17.1 Introduction to tables
  11341.    * 17.2 The CSS table model
  11342.         o 17.2.1 Anonymous table objects
  11343.    * 17.3 Column selectors
  11344.    * 17.4 Tables in the visual formatting model
  11345.         o 17.4.1 Caption position and alignment
  11346.    * 17.5 Visual layout of table contents
  11347.         o 17.5.1 Table layers and transparency
  11348.         o 17.5.2 Table width algorithms: the 'table-layout' property
  11349.              + Fixed table layout
  11350.              + Automatic table layout
  11351.         o 17.5.3 Table height algorithms
  11352.         o 17.5.4 Horizontal alignment in a column
  11353.         o 17.5.5 Dynamic row and column effects
  11354.    * 17.6 Borders
  11355.         o 17.6.1 The separated borders model
  11356.              + Borders around empty cells: the 'empty-cells' property
  11357.         o 17.6.2 The collapsing border model
  11358.              + Border conflict resolution
  11359.         o 17.6.3 Border styles
  11360.    * 17.7 Audio rendering of tables
  11361.         o 17.7.1 Speaking headers: the 'speak-header' property
  11362.  
  11363. 17.1 Introduction to tables
  11364.  
  11365. Tables represent relationships between data. Authors specify these
  11366. relationships in the document language and specify their presentation in
  11367. CSS, in two ways: visually and aurally.
  11368.  
  11369. Authors may specify the visual formatting of a table as a rectangular grid
  11370. of cells. Rows and columns of cells may be organized into row groups and
  11371. column groups. Rows, columns, row groups, row columns, and cells may have
  11372. borders drawn around them (there are two border models in CSS2). Authors may
  11373. align data vertically or horizontally within a cell and align data in all
  11374. cells of a row or column.
  11375.  
  11376. Authors may also specify the aural rendering of a table; how headers and
  11377. data will be spoken. In the document language, authors may label cells and
  11378. groups of cells so that when rendered aurally, cell headers are spoken
  11379. before cell data. In effect, this "serializes" the table: users browsing the
  11380. table aurally hear a sequence of headers followed by data.
  11381.  
  11382. Example(s):
  11383.  
  11384. Here is a simple three-row, three-column table described in HTML 4.0:
  11385.  
  11386. <TABLE>
  11387. <CAPTION>This is a simple 3x3 table</CAPTION>
  11388. <TR id="row1">
  11389.    <TH>Header 1      <TD>Cell 1        <TD>Cell 2
  11390. <TR id="row2">
  11391.    <TH>Header 2      <TD>Cell 3        <TD>Cell 4
  11392. <TR id="row3">
  11393.    <TH>Header 3      <TD>Cell 5        <TD>Cell 6
  11394. </TABLE>
  11395.  
  11396. This code creates one table (the TABLE element), three rows (the TR
  11397. elements), three header cells (the TH elements), and six data cells (the TD
  11398. elements). Note that the three columns of this example are specified
  11399. implicitly: there are as many columns in the table as required by header and
  11400. data cells.
  11401.  
  11402. The following CSS rule centers the text horizontally in the header cells and
  11403. present the data with a bold font weight:
  11404.  
  11405. TH { text-align: center; font-weight: bold }
  11406.  
  11407. The next rules align the text of the header cells on their baseline and
  11408. vertically centers the text in each data cell:
  11409.  
  11410. TH { vertical-align: baseline }
  11411. TD { vertical-align: middle }
  11412.  
  11413. The next rules specify that the top row will be surrounded by a 3px solid
  11414. blue border and each of the other rows will be surrounded by a 1px solid
  11415. black border:
  11416.  
  11417. TABLE   { border-collapse: collapse }
  11418. TR#row1 { border-top: 3px solid blue }
  11419. TR#row2 { border-top: 1px solid black }
  11420. TR#row3 { border-top: 1px solid black }
  11421.  
  11422. Note, however, that the borders around the rows overlap where the rows meet.
  11423. What color (black or blue) and thickness (1px or 3px) will the border
  11424. between row1 and row2 be? We discuss this in the section on border conflict
  11425. resolution.
  11426.  
  11427. The following rule puts the table caption above the table:
  11428.  
  11429. CAPTION { caption-side: top }
  11430.  
  11431. Finally, the following rule specifies that, when rendered aurally, each row
  11432. of data is to be spoken as a "Header, Data, Data":
  11433.  
  11434. TH { speak-header: once }
  11435.  
  11436. For instance, the first row would be spoken "Header1 Cell1 Cell2". On the
  11437. other hand, with the following rule:
  11438.  
  11439. TH { speak-header: always }
  11440.  
  11441. it would be spoken "Header1 Cell1 Header1 Cell2".
  11442.  
  11443. The preceding example shows how CSS works with HTML 4.0 elements; in HTML
  11444. 4.0, the semantics of the various table elements (TABLE, CAPTION, THEAD,
  11445. TBODY, TFOOT, COL, COLGROUP, TH, and TD) are well-defined. In other document
  11446. languages (such as XML applications), there may not be pre-defined table
  11447. elements. Therefore, CSS2 allows authors to "map" document language elements
  11448. to table elements via the 'display' property. For example, the following
  11449. rule makes the FOO element act like an HTML TABLE element and the BAR
  11450. element act like a CAPTION element:
  11451.  
  11452. FOO { display : table }
  11453. BAR { display : table-caption }
  11454.  
  11455. We discuss the various table elements in the following section. In this
  11456. specification, the term table element refers to any element involved in the
  11457. creation of a table. An "internal" table element is one that produces a row,
  11458. row group, column, column group, or cell.
  11459.  
  11460. 17.2 The CSS table model
  11461.  
  11462. The CSS table model is based on the HTML 4.0 table model, in which the
  11463. structure of a table closely parallels the visual layout of the table. In
  11464. this model, a table consists of an optional caption and any number of rows
  11465. of cells. The table model is said to be "row primary" since authors specify
  11466. rows, not columns, explicitly in the document language. Columns are derived
  11467. once all the rows have been specified -- the first cell of each row belongs
  11468. to the first column, the second to the second column, etc.). Rows and
  11469. columns may be grouped structurally and this grouping reflected in
  11470. presentation (e.g., a border may be drawn around a group of rows).
  11471.  
  11472. Thus, the table model consists of tables, captions, rows, row groups,
  11473. columns, column groups, and cells.
  11474.  
  11475. The CSS model does not require that the document language include elements
  11476. that correspond to each of these components. For document languages (such as
  11477. XML applications) that do not have pre-defined table elements, authors must
  11478. map document language elements to table elements; this is done with the
  11479. 'display' property. The following 'display' values assign table semantics to
  11480. an arbitrary element:
  11481.  
  11482. table (In HTML: TABLE)
  11483.      Specifies that an element defines a block-level table: it is a
  11484.      rectangular block that participates in a block formatting context.
  11485. inline-table (In HTML: TABLE)
  11486.      Specifies that an element defines an inline-level table: it is a
  11487.      rectangular block that participates in an inline formatting context).
  11488. table-row (In HTML: TR)
  11489.      Specifies that an element is a row of cells.
  11490. table-row-group (In HTML: TBODY)
  11491.      Specifies that an element groups one or more rows.
  11492. table-header-group (In HTML: THEAD)
  11493.      Like 'table-row-group', but for visual formatting, the row group is
  11494.      always displayed before all other rows and rowgroups and after any top
  11495.      captions. Print user agents may repeat footer rows on each page spanned
  11496.      by a table.
  11497. table-footer-group (In HTML: TFOOT)
  11498.      Like 'table-row-group', but for visual formatting, the row group is
  11499.      always displayed after all other rows and rowgroups and before any
  11500.      bottom captions. Print user agents may repeat footer rows on each page
  11501.      spanned by a table.
  11502. table-column (In HTML: COL)
  11503.      Specifies that an element describes a column of cells.
  11504. table-column-group (In HTML: COLGROUP)
  11505.      Specifies that an element groups one or more columns.
  11506. table-cell (In HTML: TD, TH)
  11507.      Specifies that an element represents a table cell.
  11508. table-caption (In HTML: CAPTION)
  11509.      Specifies a caption for the table.
  11510.  
  11511. Elements with 'display' set to 'table-column' or 'table-column-group' are
  11512. not rendered (exactly as if they had 'display: none'), but they are useful,
  11513. because they may have attributes which induce a certain style for the
  11514. columns they represent.
  11515.  
  11516. The default style sheet for HTML 4.0 in the appendix illustrates the use of
  11517. these values for HTML 4.0:
  11518.  
  11519. TABLE    { display: table }
  11520. TR       { display: table-row }
  11521. THEAD    { display: table-header-group }
  11522. TBODY    { display: table-row-group }
  11523. TFOOT    { display: table-footer-group }
  11524. COL      { display: table-column }
  11525. COLGROUP { display: table-column-group }
  11526. TD, TH   { display: table-cell }
  11527. CAPTION  { display: table-caption }
  11528.  
  11529. User agents may ignore these 'display' property values for HTML documents,
  11530. since authors should not alter an element's expected behavior.
  11531.  
  11532. 17.2.1 Anonymous table objects
  11533.  
  11534. Document languages other than HTML may not contain all the elements in the
  11535. CSS2 table model. In these cases, the "missing" elements must be assumed in
  11536. order for the table model to work. The missing elements generate anonymous
  11537. objects (e.g., anonymous boxes in visual table layout) according to the
  11538. following rules:
  11539.  
  11540.   1. Any table element will automatically generate necessary anonymous table
  11541.      objects around itself, consisting of at least three nested objects
  11542.      corresponding to a 'table'/'inline-table' element, a 'table-row'
  11543.      element, and a 'table-cell' element.
  11544.   2. If the parent P of a 'table-cell' element T is not a 'table-row', an
  11545.      object corresponding to a 'table-row' will be generated between P and
  11546.      T. This object will span all consecutive 'table-cell' siblings (in the
  11547.      document tree) of T.
  11548.   3. If the parent P of a 'table-row' element T is not a 'table',
  11549.      'inline-table', or 'table-row-group' element, an object corresponding
  11550.      to a 'table' element will be generated between P and T. This object
  11551.      will span all consecutive siblings (in the document tree) of T that
  11552.      require a 'table' parent: 'table-row', 'table-row-group',
  11553.      'table-header-group', 'table-footer-group', 'table-column',
  11554.      'table-column-group', and 'caption'.
  11555.   4. If the parent P of a 'table-row-group' (or 'table-header-group' or
  11556.      'table-footer-group') element T is not a 'table' or 'inline-table', an
  11557.      object corresponding to a 'table' element will be generated between P
  11558.      and T. This object will span all consecutive siblings (in the document
  11559.      tree) of T that require a 'table' parent: 'table-row',
  11560.      'table-row-group', 'table-header-group', 'table-footer-group',
  11561.      'table-column', 'table-column-group', and 'caption'.
  11562.   5. If a child T of a 'table-row' element P is not a 'table-cell' element,
  11563.      an object corresponding to a 'table-cell' element will be generated
  11564.      between P and T. This object spans all consecutive siblings of T that
  11565.      are not 'table-cell' elements.
  11566.  
  11567. Example(s):
  11568.  
  11569. In this XML example, a 'table' element is assumed to contain the HBOX
  11570. element:
  11571.  
  11572. <HBOX>
  11573.   <VBOX>George</VBOX>
  11574.   <VBOX>4287</VBOX>
  11575.   <VBOX>1998</VBOX>
  11576. </HBOX>
  11577.  
  11578. because the associated style sheet is:
  11579.  
  11580. HBOX { display: table-row }
  11581. VBOX { display: table-cell }
  11582.  
  11583. Example(s):
  11584.  
  11585. In this example, three 'table-cell' elements are assumed to contain the text
  11586. in the ROWs. Note that the text is further encapsulated in anonymous inline
  11587. boxes, as explained in visual formatting model:
  11588.  
  11589. <STACK>
  11590.   <ROW>This is the <D>top</D> row.</ROW>
  11591.   <ROW>This is the <D>middle</D> row.</ROW>
  11592.   <ROW>This is the <D>bottom</D> row.</ROW>
  11593. </STACK>
  11594.  
  11595. The style sheet is:
  11596.  
  11597. STACK { display: inline-table }
  11598. ROW   { display: table-row }
  11599. D     { display: inline; font-weight: bolder }
  11600.  
  11601. HTML user agents are not required to create anonymous objects according to
  11602. the above rules.
  11603.  
  11604. 17.3 Column selectors
  11605.  
  11606. Table cells may belong to two contexts: rows and columns. However, in the
  11607. source document cells are descendants of rows, never of columns.
  11608. Nevertheless, some aspects of cells can be influenced by setting properties
  11609. on columns.
  11610.  
  11611. The following properties apply to column and column-group elements:
  11612.  
  11613. 'border'
  11614.      The various border properties apply to columns only if
  11615.      'border-collapse' is set to 'collapse' on the table element. In that
  11616.      case, borders set on columns and column groups are input to the
  11617.      conflict resolution algorithm that selects the border styles at every
  11618.      cell edge.
  11619. 'background'
  11620.      The background properties set the background for cells in the column,
  11621.      but only if both the cell and row have transparent backgrounds. See
  11622.      "Table layers and transparency."
  11623. 'width'
  11624.      The 'width' property gives the minimum width for the column.
  11625. 'visibility'
  11626.      If the 'visibility' of a column is set to 'collapse', none of the cells
  11627.      in the column are rendered, and cells that span into other columns are
  11628.      clipped. In addition, the width of the table is diminished by the width
  11629.      the column would have taken up. See "Dynamic effects" below. Other
  11630.      values for 'visibility' have no effect.
  11631.  
  11632. Example(s):
  11633.  
  11634. Here are some examples of style rules that set properties on columns. The
  11635. first two rules together implement the "rules" attribute of HTML 4.0 with a
  11636. value of "cols". The third rule makes the "totals" column blue, the final
  11637. two rules shows how to make a column a fixed size, by using the fixed layout
  11638. algorithm.
  11639.  
  11640. COL   { border-style: none solid }
  11641. TABLE { border-style: hidden }
  11642. COL.totals { background: blue }
  11643. TABLE { table-layout: fixed }
  11644. COL.totals { width: 5em }
  11645.  
  11646. 17.4 Tables in the visual formatting model
  11647.  
  11648. In terms of the visual formatting model, a table may behave like a
  11649. block-level or replaced inline-level element. Tables have content, padding,
  11650. borders, and margins.
  11651.  
  11652. In both cases, the table element generates an anonymous box that contains
  11653. the table box itself and the caption's box (if present). The table and
  11654. caption boxes retain their own content, padding, margin, and border areas,
  11655. and the dimensions of the rectangular anonymous box are the smallest
  11656. required to contain both. Vertical margins collapse where the table box and
  11657. caption box touch. Any repositioning of the table must move the entire
  11658. anonymous box, not just the table box, so that the caption follows the
  11659. table.
  11660.  
  11661. [A table with a caption aboveit; both have margins and the margins between them are collapsed, asis normal for vertical margins.]   [D]
  11662.  
  11663. Diagram of a table with a caption above it; the bottom margin of the caption
  11664. is collapsed with the top margin of the table.
  11665.  
  11666. 17.4.1 Caption position and alignment
  11667.  
  11668. 'caption-side'
  11669.      Value:         top | bottom | left | right | inherit
  11670.      Initial:       top
  11671.      Applies to:    'table-caption' elements
  11672.      Inherited:     yes
  11673.      Percentages:   N/A
  11674.      Media:         visual
  11675.  
  11676. This property specifies the position of the caption box with respect to the
  11677. table box. Values have the following meanings:
  11678.  
  11679. top
  11680.      Positions the caption box above the table box.
  11681. bottom
  11682.      Positions the caption box below the table box.
  11683. left
  11684.      Positions the caption box to the left of the table box.
  11685. right
  11686.      Positions the caption box to the right of the table box.
  11687.  
  11688. Captions above or below a 'table' element are formatted very much as if they
  11689. were a block element before or after the table, except that (1) they inherit
  11690. inheritable properties from the table, and (2) they are not considered to be
  11691. a block box for the purposes of any 'compact' or 'run-in' element that may
  11692. precede the table.
  11693.  
  11694. A caption that is above or below a table box also behaves like a block box
  11695. for width calculations; the width is computed with respect to the width of
  11696. the table box's containing block.
  11697.  
  11698. For a caption that is on the left or right side of a table box, on the other
  11699. hand, a value other than 'auto' for 'width' sets the width explicitly, but
  11700. 'auto' tells the user agent to chose a "reasonable width". This may vary
  11701. between "the narrowest possible box" to "a single line", so we recommend
  11702. that users do not specify 'auto' for left and right caption widths.
  11703.  
  11704. To align caption content horizontally within the caption box, use the
  11705. 'text-align' property. For vertical alignment of a left or right caption box
  11706. with respect to the table box, use the 'vertical-align' property. The only
  11707. meaningful values in this case are 'top', 'middle', and 'bottom'. All other
  11708. values are treated the same as 'top'.
  11709.  
  11710. Example(s):
  11711.  
  11712. In this example, the 'caption-side' property places captions below tables.
  11713. The caption will be as wide as the parent of the table, and caption text
  11714. will be left-justified.
  11715.  
  11716. CAPTION { caption-side: bottom;
  11717.           width: auto;
  11718.           text-align: left }
  11719.  
  11720. Example(s):
  11721.  
  11722. The following example shows how to put a caption in the left margin. The
  11723. table itself is centered, by setting its left and right margins to 'auto',
  11724. and the whole box with table and caption is shifted into the left margin by
  11725. the same amount as the width of the caption.
  11726.  
  11727. BODY {
  11728.     margin-left: 8em
  11729. }
  11730. TABLE {
  11731.     margin-left: auto;
  11732.     margin-right: auto
  11733. }
  11734. CAPTION {
  11735.     caption-side: left;
  11736.     margin-left: -8em;
  11737.     width: 8em;
  11738.     text-align: right;
  11739.     vertical-align: bottom
  11740. }
  11741.  
  11742. Assuming the width of the table is less than the available width, the
  11743. formatting will be similar to this:
  11744.  
  11745. [A centered table with acaption in the left margin of the page]   [D]
  11746.  
  11747. Diagram showing a centered table with the caption extending into the left
  11748. margin, as a result of a negative 'margin-left' property.
  11749.  
  11750. 17.5 Visual layout of table contents
  11751.  
  11752. Like other elements of the document language, internal table elements
  11753. generate rectangular boxes with content, padding, and borders. They do not
  11754. have margins, however.
  11755.  
  11756. The visual layout of these boxes is governed by a rectangular, irregular
  11757. grid of rows and columns. Each box occupies a whole number of grid cells,
  11758. determined according to the following rules. These rules do not apply to
  11759. HTML 4.0 or earlier HTML versions; HTML imposes its own limitations on row
  11760. and column spans.
  11761.  
  11762.   1. Each row box occupies one row of grid cells. Together, the row boxes
  11763.      fill the table from top to bottom in the order they occur in the source
  11764.      document (i.e., the table occupies exactly as many grid rows as there
  11765.      are row elements).
  11766.   2. A row group occupies the same grid cells as the rows it contains.
  11767.   3. A column box occupies one or more columns of grid cells. Column boxes
  11768.      are placed next to each other in the order they occur. The first column
  11769.      box may be either on the left or on the right, depending on the value
  11770.      of the 'direction' property of the table.
  11771.   4. A column group box occupies the same grid cells as the columns it
  11772.      contains.
  11773.   5. Cells may span several rows or columns. (Although CSS2 doesn't define
  11774.      how the number of spanned rows or columns is determined, a user agent
  11775.      may have special knowledge about the source document; a future version
  11776.      of CSS may provide a way to express this knowledge in CSS syntax.) Each
  11777.      cell is thus a rectangular box, one or more grid cells wide and high.
  11778.      The top row of this rectangle is in the row specified by the cell's
  11779.      parent. The rectangle must be as far to the left as possible, but it
  11780.      may not overlap with any other cell box, and must be to the right of
  11781.      all cells in the same row that are earlier in the source document.
  11782.      (This constraint holds if the 'direction' property of the table is
  11783.      'ltr'; if the 'direction' is 'rtl', interchange "left" and "right" in
  11784.      the previous sentence.)
  11785.   6. A cell box cannot extend beyond the last row box of a table or
  11786.      row-group; the user agents must shorten it until it fits.
  11787.  
  11788. Note. Table cells may be relatively and absolutely positioned, but this is
  11789. not recommended: positioning and floating remove a box from the flow,
  11790. affecting table alignment.
  11791.  
  11792. Here are two examples. The first is assumed to occur in an HTML document:
  11793.  
  11794. <TABLE>
  11795. <TR><TD>1 <TD rowspan="2">2 <TD>3 <TD>4
  11796. <TR><TD colspan="2">5
  11797. </TABLE>
  11798.  
  11799. <TABLE>
  11800. <ROW><CELL>1 <CELL rowspan="2">2 <CELL>3 <CELL>4
  11801. <ROW><CELL colspan="2">5
  11802. </TABLE>
  11803.  
  11804. The second table is formatted as in the figure on the right. However, the
  11805. HTML table's rendering is explicitly undefined by HTML, and CSS doesn't try
  11806. to define it. User agents are free to render it, e.g., as in the figure on
  11807. the left.
  11808.  
  11809. [One table with overlappingcells and one without]   [D]
  11810.  
  11811. On the left, one possible rendering of an erroneous HTML 4.0 table; on the
  11812. right, the only possible formatting of a similar, non-HTML table.
  11813.  
  11814. 17.5.1 Table layers and transparency
  11815.  
  11816. For the purposes of finding the background of each table cell, the different
  11817. table elements may be thought of as being on six superimposed layers. The
  11818. background set on an element in one of the layers will only be visible if
  11819. the layers above it have a transparent background.
  11820.  
  11821. [schema of table layers]   [D]
  11822.  
  11823. Schema of table layers.
  11824.  
  11825.   1. The lowest layer is a single plane, representing the table box itself.
  11826.      Like all boxes, it may be transparent.
  11827.  
  11828.   2. The next layer contains the column groups. The columns groups are as
  11829.      tall as the table, but they need not cover the whole table
  11830.      horizontally.
  11831.  
  11832.   3. On top of the column groups are the areas representing the column
  11833.      boxes. Like column groups, columns are as tall as the table, but need
  11834.      not cover the whole table horizontally.
  11835.  
  11836.   4. Next is the layer containing the row groups. Each row group is as wide
  11837.      as the table. Together, the row groups completely cover the table from
  11838.      top to bottom.
  11839.  
  11840.   5. The next to last layer contains the rows. The rows also cover the whole
  11841.      table.
  11842.  
  11843.   6. The topmost layer contains the cells themselves. As the figure shows,
  11844.      although all rows contain the same number of cells, not every cell may
  11845.      have specified content. These "empty" cells are transparent, letting
  11846.      lower layers shine through.
  11847.  
  11848. In the following example, the first row contains four cells, but the second
  11849. row contains no cells, and thus the table background shines through, except
  11850. where a cell from the first row spans into this row. The following HTML code
  11851. and style rules
  11852.  
  11853. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  11854. <HTML>
  11855.   <HEAD>
  11856.     <STYLE type="text/css">
  11857.       TABLE { background: #ff0; border-collapse: collapse }
  11858.       TD    { background: red; border: double black }
  11859.     </STYLE>
  11860.   </HEAD>
  11861.   <BODY>
  11862.     <P>
  11863.     <TABLE>
  11864.       <TR>
  11865.         <TD> 1
  11866.         <TD rowspan="2"> 2
  11867.         <TD> 3
  11868.         <TD> 4
  11869.       </TR>
  11870.       <TR><TD></TD></TR>
  11871.     </TABLE>
  11872.   </BODY>
  11873. </HTML>
  11874.  
  11875. might be formatted as follows:
  11876.  
  11877. [Table with three empty cellsin bottom row]   [D]
  11878.  
  11879. Table with three empty cells in the bottom row.
  11880.  
  11881. 17.5.2 Table width algorithms: the 'table-layout' property
  11882.  
  11883. CSS does not define an "optimal" layout for tables since, in many cases,
  11884. what is optimal is a matter of taste. CSS does define constraints that user
  11885. agents must respect when laying out a table. User agents may use any
  11886. algorithm they wish to do so, and are free to prefer rendering speed over
  11887. precision, except when the "fixed layout algorithm" is selected.
  11888.  
  11889. 'table-layout'
  11890.      Value:         auto | fixed | inherit
  11891.      Initial:       auto
  11892.      Applies to:    'table' and 'inline-table' elements
  11893.      Inherited:     no
  11894.      Percentages:   N/A
  11895.      Media:         visual
  11896.  
  11897. The 'table-layout' property controls the algorithm used to lay out the table
  11898. cells, rows, and columns. Values have the following meaning:
  11899.  
  11900. fixed
  11901.      Use the fixed table layout algorithm
  11902. auto
  11903.      Use any automatic table layout algorithm
  11904.  
  11905. The two algorithms are described below.
  11906.  
  11907. Fixed table layout
  11908.  
  11909. With this (fast) algorithm, the horizontal layout of the table does not
  11910. depend on the contents of the cells; it only depends on the table's width,
  11911. the width of the columns, and borders or cell spacing.
  11912.  
  11913. The table's width may be specified explicitly with the 'width' property. A
  11914. value of 'auto' (for both 'display: table' and 'display: inline-table')
  11915. means use the automatic table layout algorithm.
  11916.  
  11917. In the fixed table layout algorithm, the width of each column is determined
  11918. as follows:
  11919.  
  11920.   1. A column element with a value other than 'auto' for the 'width'
  11921.      property sets the width for that column.
  11922.   2. Otherwise, a cell in the first row with a value other than 'auto' for
  11923.      the 'width' property sets the width for that column. If the cell spans
  11924.      more than one column, the width is divided over the columns.
  11925.   3. Any remaining columns equally divide the remaining horizontal table
  11926.      space (minus borders or cell spacing).
  11927.  
  11928. The width of the table is then the greater of the value of the 'width'
  11929. property for the table element and the sum of the column widths (plus cell
  11930. spacing or borders). If the table is wider than the columns, the extra space
  11931. should be distributed over the columns.
  11932.  
  11933. In this manner, the user agent can begin to lay out the table once the
  11934. entire first row has been received. Cells in subsequent rows do not affect
  11935. column widths. Any cell that has content that overflows uses the 'overflow'
  11936. property to determine whether to clip the overflow content.
  11937.  
  11938. Automatic table layout
  11939.  
  11940. In this algorithm (which generally requires no more than two passes), the
  11941. table's width is given by the width of its columns (and intervening
  11942. borders). This algorithm reflects the behavior of several popular HTML user
  11943. agents at the writing of this specification. UAs are not required to
  11944. implement this algorithm to determine the table layout in the case that
  11945. 'table-layout' is 'auto'; they can use any other algorithm.
  11946.  
  11947. This algorithm may be inefficient since it requires the user agent to have
  11948. access to all the content in the table before determining the final layout
  11949. and may demand more than one pass.
  11950.  
  11951. Column widths are determined as follows:
  11952.  
  11953.   1. Calculate the minimum content width (MCW) of each cell: the formatted
  11954.      content may span any number of lines but may not overflow the cell box.
  11955.      If the specified 'width' (W) of the cell is greater than MCW, W is the
  11956.      minimum cell width. A value of 'auto' means that MCW is the minimum
  11957.      cell width.
  11958.  
  11959.      Also, calculate the "maximum" cell width of each cell: formatting then
  11960.      content without breaking lines other than where explicit line breaks
  11961.      occur.
  11962.   2. For each column, determine a maximum and minimum column width from the
  11963.      cells that span only that column. The minimum is that required by the
  11964.      cell with the largest minimum cell width (or the column 'width',
  11965.      whichever is larger). The maximum is that required by the cell with the
  11966.      largest maximum cell width (or the column 'width', whichever is
  11967.      larger).
  11968.   3. For each cell that spans more than one column, increase the minimum
  11969.      widths of the columns it spans so that together, they are at least as
  11970.      wide as the cell. Do the same for the maximum widths. If possible,
  11971.      widen all spanned columns by approximately the same amount.
  11972.  
  11973. This gives a maximum and minimum width for each column. Column widths
  11974. influence the final table width as follows:
  11975.  
  11976.   1. If the 'table' or 'inline-table' element's 'width' property has a
  11977.      specified value (W) other than 'auto', the property's computed value is
  11978.      the greater of W and the minimum width required by all the columns plus
  11979.      cell spacing or borders (MIN). If W is greater than MIN, the extra
  11980.      width should be distributed over the columns.
  11981.   2. If the 'table' or 'inline-table' element has 'width: auto', the
  11982.      computed table width is the greater of the table's containing block
  11983.      width and MIN. However, if the maximum width required by the columns
  11984.      plus cell spacing or borders (MAX) is less than that of the containing
  11985.      block, use MAX.
  11986.  
  11987. A percentage value for a column width is relative to the table width. If the
  11988. table has 'width: auto', a percentage represents a constraint on the
  11989. column's width, which a UA should try to satisfy. (Obviously, this is not
  11990. always possible: if the column's width is '110%', the constraint cannot be
  11991. satisfied.)
  11992.  
  11993. Note. In this algorithm, rows (and row groups) and columns (and column
  11994. groups) both constrain and are constrained by the dimensions of the cells
  11995. they contain. Setting the width of a column may indirectly influence the
  11996. height of a row, and vice versa.
  11997.  
  11998. 17.5.3 Table height algorithms
  11999.  
  12000. The height of a table is given by the 'height' property for the 'table' or
  12001. 'inline-table' element. A value of 'auto' means that the height is the sum
  12002. of the row heights plus any cell spacing or borders. Any other value
  12003. specifies the height explicitly; the table may thus be taller or shorter
  12004. than the height of its rows. CSS2 does not specify rendering when the
  12005. specified table height differs from the content height, in particular
  12006. whether content height should override specified height; if it doesn't, how
  12007. extra space should be distributed among rows that add up to less than the
  12008. specified table height; or, if the content height exceeds the specified
  12009. table height, whether the UA should provide a scrolling mechanism. Note.
  12010. Future versions of CSS may specify this further.
  12011.  
  12012. The height of a 'table-row' element's box is calculated once the user agent
  12013. has all the cells in the row available: it is the maximum of the row's
  12014. specified 'height' and the minimum height (MIN) required by the cells. A
  12015. 'height' value of 'auto' for a 'table-row' means the computed row height is
  12016. MIN. MIN depends on cell box heights and cell box alignment (much like the
  12017. calculation of a line box height). CSS2 does not define what percentage
  12018. values of 'height' refer to when specified for table rows and row groups.
  12019.  
  12020. In CSS2, the height of a cell box is the maximum of the table cell's
  12021. 'height' property and the minimum height required by the content (MIN). A
  12022. value of 'auto' for 'height' implies a computed value of MIN. CSS2 does not
  12023. define what percentage values of 'height' refer to when specified for table
  12024. cells.
  12025.  
  12026. CSS2 does not specify how cells that span more than row affect row height
  12027. calculations except that the sum of the row heights involved must be great
  12028. enough to encompass the cell spanning the rows.
  12029.  
  12030. The 'vertical-align' property of each table cell determines its alignment
  12031. within the row. Each cell's content has a baseline, a top, a middle, and a
  12032. bottom, as does the row itself. In the context of tables, values for
  12033. 'vertical-align' have the following meanings:
  12034.  
  12035. baseline
  12036.      The baseline of the cell is put at the same height as the baseline of
  12037.      the first of the rows it spans (see below for the definition of
  12038.      baselines of cells and rows).
  12039. top
  12040.      The top of the cell box is aligned with the top of the first row it
  12041.      spans.
  12042. bottom
  12043.      The bottom of the cell box is aligned with the bottom of the last row
  12044.      it spans.
  12045. middle
  12046.      The center of the cell is aligned with the center of the rows it spans.
  12047. sub, super, text-top, text-bottom
  12048.      These values do not apply to cells; the cell is aligned at the baseline
  12049.      instead.
  12050.  
  12051. The baseline of a cell is the baseline of the first line box in the cell. If
  12052. there is no text, the baseline is the baseline of whatever object is
  12053. displayed in the cell, or, if it has none, the bottom of the cell box. The
  12054. maximum distance between the top of the cell box and the baseline over all
  12055. cells that have 'vertical-align: baseline' is used to set the baseline of
  12056. the row. Here is an example:
  12057.  
  12058. [Example of verticallyaligning the cells]   [D]
  12059.  
  12060. Diagram showing the effect of various values of 'vertical-align' on table
  12061. cells.
  12062.  
  12063. Cell boxes 1 and 2 are aligned at their baselines. Cell box 2 has the
  12064. largest height above the baseline, so that determines the baseline of the
  12065. row. Note that if there is no cell box aligned at its baseline, the row will
  12066. not have (nor need) a baseline.
  12067.  
  12068. To avoid ambiguous situations, the alignment of cells proceeds in the
  12069. following order:
  12070.  
  12071.   1. First the cells that are aligned on their baseline are positioned. This
  12072.      will establish the baseline of the row. Next the cells with
  12073.      'vertical-align: top' are positioned.
  12074.   2. The row now has a top, possibly a baseline, and a provisional height,
  12075.      which is the distance from the top to the lowest bottom of the cells
  12076.      positioned so far. (See conditions on the cell padding below.)
  12077.   3. If any of the remaining cells, those aligned at the bottom or the
  12078.      middle, have a height that is larger than the current height of the
  12079.      row, the height of the row will be increased to the maximum of those
  12080.      cells, by lowering the bottom.
  12081.   4. Finally the remaining cells are positioned.
  12082.  
  12083. Cell boxes that are smaller than the height of the row receive extra top or
  12084. bottom padding.
  12085.  
  12086. 17.5.4 Horizontal alignment in a column
  12087.  
  12088. The horizontal alignment of a cell's content within a cell box is specified
  12089. with the 'text-align' property.
  12090.  
  12091. When the 'text-align' property for more than one cell in a column is set to
  12092. a <string> value, the content of those cells is aligned along a vertical
  12093. axis. The beginning of the string touches this axis. Character
  12094. directionality determines whether the string lies to the left or right of
  12095. the axis.
  12096.  
  12097. Aligning text in this way is only useful if the text fits on one line. The
  12098. result is undefined if the cell content spans more than one line.
  12099.  
  12100. If value of 'text-align' for a table cell is a string but the string doesn't
  12101. occur in the cell content, the end of the cell's content touches the
  12102. vertical axis of alignment.
  12103.  
  12104. Note that the strings do not have to be the same for each cell, although
  12105. they usually are.
  12106.  
  12107. CSS does not provide a way specify the offset of the vertical alignment axis
  12108. with respect to the edge of a column box.
  12109.  
  12110. Example(s):
  12111.  
  12112. The following style sheet:
  12113.  
  12114.    TD { text-align: "." }
  12115.    TD:before { content: "$" }
  12116.  
  12117. will cause the column of dollar figures in the following HTML table:
  12118.  
  12119.   <TABLE>
  12120.   <COL width="40">
  12121.   <TR> <TH>Long distance calls
  12122.   <TR> <TD> 1.30
  12123.   <TR> <TD> 2.50
  12124.   <TR> <TD> 10.80
  12125.   <TR> <TD> 111.01
  12126.   <TR> <TD> 85.
  12127.   <TR> <TD> 90
  12128.   <TR> <TD> .05
  12129.   <TR> <TD> .06
  12130.   </TABLE>
  12131.  
  12132. to align along the decimal point. For fun, we have used the :before
  12133. pseudo-element to insert a dollar sign before each figure. The table might
  12134. be rendered as follows:
  12135.  
  12136. Long distance calls
  12137.               $1.30
  12138.               $2.50
  12139.              $10.80
  12140.             $111.01
  12141.              $85.
  12142.              $90
  12143.                $.05
  12144.                $.06
  12145.  
  12146. 17.5.5 Dynamic row and column effects
  12147.  
  12148. The 'visibility' property takes the value 'collapse' for row, row group,
  12149. column, and column group elements. This value causes the entire row or
  12150. column to be removed from the display, and the space normally taken up by
  12151. the row or column to be made available for other content. The suppression of
  12152. the row or column, however, does not otherwise affect the layout of the
  12153. table. This allows dynamic effects to remove table rows or columns without
  12154. forcing a re-layout of the table in order to account for the potential
  12155. change in column constraints.
  12156.  
  12157. 17.6 Borders
  12158.  
  12159. There are two distinct models for setting borders on table cells in CSS. One
  12160. is most suitable for so-called separated borders around individual cells,
  12161. the other is suitable for borders that are continuous from one end of the
  12162. table to the other. Many border styles can be achieved with either model, so
  12163. it is often a matter of taste which one is used.
  12164.  
  12165. 'border-collapse'
  12166.      Value:         collapse | separate | inherit
  12167.      Initial:       collapse
  12168.      Applies to:    'table' and 'inline-table' elements
  12169.      Inherited:     yes
  12170.      Percentages:   N/A
  12171.      Media:         visual
  12172.  
  12173. This property selects a table's border model. The value 'separate' selects
  12174. the separated borders border model. The value 'collapse' selects the
  12175. collapsing borders model. The models are described below.
  12176.  
  12177. 17.6.1 The separated borders model
  12178.  
  12179. 'border-spacing'
  12180.      Value:         <length> <length>? | inherit
  12181.      Initial:       0
  12182.      Applies to:    'table' and 'inline-table' elements
  12183.      Inherited:     yes
  12184.      Percentages:   N/A
  12185.      Media:         visual
  12186.  
  12187. The lengths specify the distance that separates adjacent cell borders. If
  12188. one length is specified, it gives both the horizontal and vertical spacing.
  12189. If two are specified, the first gives the horizontal spacing and the second
  12190. the vertical spacing. Lengths may not be negative.
  12191.  
  12192. In this model, each cell has an individual border. The 'border-spacing'
  12193. property specifies the distance between the borders of adjacent cells. This
  12194. space is filled with the background of the table element. Rows, columns, row
  12195. groups, and column groups cannot have borders (i.e., user agents must ignore
  12196. the border properties for those elements).
  12197.  
  12198. Example(s):
  12199.  
  12200. The table in the figure below could be the result of a style sheet like
  12201. this:
  12202.  
  12203.   TABLE      { border: outset 10pt;
  12204.                border-collapse: separate;
  12205.                border-spacing: 15pt }
  12206.   TD         { border: inset 5pt }
  12207.   TD.special { border: inset 10pt }  /* The top-left cell */
  12208.  
  12209. [A table withborder-spacing]   [D]
  12210.  
  12211. A table with 'border-spacing' set to a length value. Note that each cell has
  12212. its own border, and the table has a separate border as well.
  12213.  
  12214. Borders around empty cells: the 'empty-cells' property
  12215.  
  12216. 'empty-cells'
  12217.      Value:         show | hide | inherit
  12218.      Initial:       show
  12219.      Applies to:    'table-cell' elements
  12220.      Inherited:     yes
  12221.      Percentages:   N/A
  12222.      Media:         visual
  12223.  
  12224. In the separated borders model, this property controls the rendering of
  12225. borders around cells that have no visible content. Empty cells and cells
  12226. with the 'visibility' property set to 'hidden' are considered to have no
  12227. visible content. Visible content includes " " and other whitespace
  12228. except ASCII CR ("\0D"), LF ("\0A"), tab ("\09"), and space ("\20").
  12229.  
  12230. When this property has the value 'show', borders are drawn around empty
  12231. cells (like normal cells).
  12232.  
  12233. A value of 'hide' means that no borders are drawn around empty cells.
  12234. Furthermore, if all the cells in a row have a value of 'hide' and have no
  12235. visible content, the entire row behaves as if it had 'display: none'.
  12236.  
  12237. Example(s):
  12238.  
  12239. The following rule causes borders to be drawn around all cells:
  12240.  
  12241. TABLE { empty-cells: show }
  12242.  
  12243. 17.6.2 The collapsing border model
  12244.  
  12245. In the collapsing border model, it is possible to specify borders that
  12246. surround all or part of a cell, row, row group, column, and column group.
  12247. Borders for HTML's "rule" attribute can be specified this way.
  12248.  
  12249. Borders are centered on the grid lines between the cells. User agents must
  12250. find a consistent rule for rounding off in the case of an odd number of
  12251. discrete units (screen pixels, printer dots).
  12252.  
  12253. The diagram below shows how the width of the table, the widths of the
  12254. borders, the padding, and the cell width interact. Their relation is given
  12255. by the following equation, which holds for every row of the table:
  12256.  
  12257.      row-width = (0.5 * border-width0) + padding-left1 + width1 +
  12258.      padding-right1 + border-width1 + padding-left2 +...+
  12259.      padding-rightn + (0.5 * border-widthn)
  12260.  
  12261. Here n is the number of cells in the row, and border-widthi refers to the
  12262. border between cells i and i + 1. Note only half of the two exterior borders
  12263. are counted in the table width; the other half of these two borders lies in
  12264. the margin area.
  12265.  
  12266. [Schema showing the widths ofcells and borders and the padding of cells]   [D]
  12267.  
  12268. Schema showing the widths of cells and borders and the padding of cells.
  12269.  
  12270. Note that in this model, the width of the table includes half the table
  12271. border. Also, in this model, a table doesn't have padding (but does have
  12272. margins).
  12273.  
  12274. Border conflict resolution
  12275.  
  12276. In the collapsing border model, borders at every edge of every cell may be
  12277. specified by border properties on a variety of elements that meet at that
  12278. edge (cells, rows, row groups, columns, column groups, and the table
  12279. itself), and these borders may vary in width, style, and color. The rule of
  12280. thumb is that at each edge the most "eye catching" border style is chosen,
  12281. except that any occurrence of the style 'hidden' unconditionally turns the
  12282. border off.
  12283.  
  12284. The following rules determine which border style "wins" in case of a
  12285. conflict:
  12286.  
  12287.   1. Borders with the 'border-style' of 'hidden' take precedence over all
  12288.      other conflicting borders. Any border with this value suppresses all
  12289.      borders at this location.
  12290.   2. Borders with a style of 'none' have the lowest priority. Only if the
  12291.      border properties of all the elements meeting at this edge are 'none'
  12292.      will the border be omitted (but note that 'none' is the default value
  12293.      for the border style.)
  12294.   3. If none of the styles is 'hidden' and at least one of them is not
  12295.      'none', then narrow borders are discarded in favor of wider ones. If
  12296.      several have the same 'border-width' than styles are preferred in this
  12297.      order: 'double', 'solid', 'dashed', 'dotted', 'ridge', 'outset',
  12298.      'groove', and the lowest: 'inset'.
  12299.   4. If border styles differ only in color, then a style set on a cell wins
  12300.      over one on a row, which wins over a row group, column, column group
  12301.      and, lastly, table.
  12302.  
  12303. Example(s):
  12304.  
  12305. The following example illustrates the application of these precedence rules.
  12306. This style sheet:
  12307.  
  12308.   TABLE          { border-collapse: collapse;
  12309.                    border: 5px solid yellow; }
  12310.   *#col1         { border: 3px solid black; }
  12311.   TD             { border: 1px solid red; padding: 1em; }
  12312.   TD.solid-blue  { border: 5px dashed blue; }
  12313.   TD.solid-green { border: 5px solid green; }
  12314.  
  12315. with this HTML source:
  12316.  
  12317. <P>
  12318. <TABLE>
  12319. <COL id="col1"><COL id="col2"><COL id="col3">
  12320. <TR id="row1">
  12321.     <TD> 1
  12322.     <TD> 2
  12323.     <TD> 3
  12324. </TR>
  12325. <TR id="row2">
  12326.     <TD> 4
  12327.     <TD class="solid-blue"> 5
  12328.     <TD class="solid-green"> 6
  12329. </TR>
  12330. <TR id="row3">
  12331.     <TD> 7
  12332.     <TD> 8
  12333.     <TD> 9
  12334. </TR>
  12335. <TR id="row4">
  12336.     <TD> 10
  12337.     <TD> 11
  12338.     <TD> 12
  12339. </TR>
  12340. <TR id="row5">
  12341.     <TD> 13
  12342.     <TD> 14
  12343.     <TD> 15
  12344. </TR>
  12345. </TABLE>
  12346.  
  12347. would produce something like this:
  12348.  
  12349. [An example of a table with collapsed borders]   [D]
  12350.  
  12351. An example of a table with collapsed borders.
  12352.  
  12353. Example(s):
  12354.  
  12355. The next example shows a table with horizontal rules between the rows. The
  12356. top border of the table is set to 'hidden' to suppress the top border of the
  12357. first row. This implements the "rules" attribute of HTML 4.0 (rules="rows").
  12358.  
  12359. TABLE[rules=rows] TR { border-top: solid }
  12360. TABLE[rules=rows]    { border-collapse: collapse;
  12361.                        border-top: hidden }
  12362.  
  12363. [Table with horizontalrules]   [D]
  12364.  
  12365. Table with horizontal rules between the rows.
  12366.  
  12367. In this case the same effect can also be achieved without setting a 'hidden'
  12368. border on TABLE, by addressing the first row separately. Which method is
  12369. preferred is a matter of taste.
  12370.  
  12371. TR:first-child { border-top: none }
  12372. TR { border-top: solid }
  12373.  
  12374. Example(s):
  12375.  
  12376. Here is another example of hidden collapsing borders:
  12377.  
  12378. [Tablewith two omitted borders]   [D]
  12379.  
  12380. Table with two omitted internal borders.
  12381.  
  12382. HTML source:
  12383.  
  12384. <TABLE style="border-collapse: collapse; border: solid;">
  12385. <TR><TD style="border-right: hidden; border-bottom: hidden">foo</TD>
  12386.     <TD style="border: solid">bar</TD></TR>
  12387. <TR><TD style="border: none">foo</TD>
  12388.     <TD style="border: solid">bar</TD></TR>
  12389. </TABLE>
  12390.  
  12391. 17.6.3 Border styles
  12392.  
  12393. Some of the values of the 'border-style' have different meanings in tables
  12394. than for other elements. In the list below they are marked with an asterisk.
  12395.  
  12396. none
  12397.      No border.
  12398. *hidden
  12399.      Same as 'none', but in the collapsing border model, also inhibits any
  12400.      other border (see the section on border conflicts).
  12401. dotted
  12402.      The border is a series of dots.
  12403. dashed
  12404.      The border is a series of short line segments.
  12405. solid
  12406.      The border is a single line segment.
  12407. double
  12408.      The border is two solid lines. The sum of the two lines and the space
  12409.      between them equals the value of 'border-width'.
  12410. groove
  12411.      The border looks as though it were carved into the canvas.
  12412. ridge
  12413.      The opposite of 'grove': the border looks as though it were coming out
  12414.      of the canvas.
  12415. *inset
  12416.      In the separated borders model, the border makes the entire box look as
  12417.      though it were embedded in the canvas. In the collapsing border model,
  12418.      same as 'groove'.
  12419. *outset
  12420.      In the separated borders model, the border makes the entire box look as
  12421.      though it were coming out of the canvas. In the collapsing border
  12422.      model, same as 'ridge'.
  12423.  
  12424. 17.7 Audio rendering of tables
  12425.  
  12426. When a table is spoken by a speech generator, the relation between the data
  12427. cells and the header cells must be expressed in a different way than by
  12428. horizontal and vertical alignment. Some speech browsers may allow a user to
  12429. move around in the 2-dimensional space, thus giving them the opportunity to
  12430. map out the spatially represented relations. When that is not possible, the
  12431. style sheet must specify at which points the headers are spoken.
  12432.  
  12433. 17.7.1 Speaking headers: the 'speak-header' property
  12434.  
  12435. 'speak-header'
  12436.      Value:         once | always | inherit
  12437.      Initial:       once
  12438.      Applies to:    elements that have table header information
  12439.      Inherited:     yes
  12440.      Percentages:   N/A
  12441.      Media:         aural
  12442.  
  12443. This property specifies whether table headers are spoken before every cell,
  12444. or only before a cell when that cell is associated with a different header
  12445. than the previous cell. Values have the following meanings:
  12446.  
  12447. once
  12448.      The header is spoken one time, before a series of cells.
  12449. always
  12450.      The header is spoken before every pertinent cell.
  12451.  
  12452. Each document language may have different mechanisms that allow authors to
  12453. specify headers. For example, in HTML 4.0 ([HTML40]), it is possible to
  12454. specify header information with three different attributes ("headers",
  12455. "scope", and "axis"), and the specification gives an algorithm for
  12456. determining header information when these attributes have not been
  12457. specified.
  12458.  
  12459. [Image of a table created in MSWord]   [D]
  12460.  
  12461. Image of a table with header cells ("San Jose" and "Seattle") that are not
  12462. in the same column or row as the data they apply to.
  12463.  
  12464. This HTML example presents the money spent on meals, hotels and transport in
  12465. two locations (San Jose and Seattle) for successive days. Conceptually, you
  12466. can think of the table in terms of a n-dimensional space. The headers of
  12467. this space are: location, day, category and subtotal. Some cells define
  12468. marks along an axis while others give money spent at points within this
  12469. space. The markup for this table is:
  12470.  
  12471. <TABLE>
  12472. <CAPTION>Travel Expense Report</CAPTION>
  12473. <TR>
  12474.   <TH></TH>
  12475.   <TH>Meals</TH>
  12476.   <TH>Hotels</TH>
  12477.   <TH>Transport</TH>
  12478.   <TH>subtotal</TH>
  12479. </TR>
  12480. <TR>
  12481.   <TH id="san-jose" axis="san-jose">San Jose</TH>
  12482. </TR>
  12483. <TR>
  12484.   <TH headers="san-jose">25-Aug-97</TH>
  12485.   <TD>37.74</TD>
  12486.   <TD>112.00</TD>
  12487.   <TD>45.00</TD>
  12488.   <TD></TD>
  12489. </TR>
  12490. <TR>
  12491.   <TH headers="san-jose">26-Aug-97</TH>
  12492.   <TD>27.28</TD>
  12493.   <TD>112.00</TD>
  12494.   <TD>45.00</TD>
  12495.   <TD></TD>
  12496. </TR>
  12497. <TR>
  12498.   <TH headers="san-jose">subtotal</TH>
  12499.   <TD>65.02</TD>
  12500.   <TD>224.00</TD>
  12501.   <TD>90.00</TD>
  12502.   <TD>379.02</TD>
  12503. </TR>
  12504. <TR>
  12505.   <TH id="seattle" axis="seattle">Seattle</TH>
  12506. </TR>
  12507. <TR>
  12508.   <TH headers="seattle">27-Aug-97</TH>
  12509.   <TD>96.25</TD>
  12510.   <TD>109.00</TD>
  12511.   <TD>36.00</TD>
  12512.   <TD></TD>
  12513. </TR>
  12514. <TR>
  12515.   <TH headers="seattle">28-Aug-97</TH>
  12516.   <TD>35.00</TD>
  12517.   <TD>109.00</TD>
  12518.   <TD>36.00</TD>
  12519.   <TD></TD>
  12520. </TR>
  12521. <TR>
  12522.   <TH headers="seattle">subtotal</TH>
  12523.   <TD>131.25</TD>
  12524.   <TD>218.00</TD>
  12525.   <TD>72.00</TD>
  12526.   <TD>421.25</TD>
  12527. </TR>
  12528. <TR>
  12529.   <TH>Totals</TH>
  12530.   <TD>196.27</TD>
  12531.   <TD>442.00</TD>
  12532.   <TD>162.00</TD>
  12533.   <TD>800.27</TD>
  12534. </TR>
  12535. </TABLE>
  12536.  
  12537. By providing the data model in this way, authors make it possible for speech
  12538. enabled-browsers to explore the table in rich ways, e.g., each cell could be
  12539. spoken as a list, repeating the applicable headers before each data cell:
  12540.  
  12541.   San Jose, 25-Aug-97, Meals:  37.74
  12542.   San Jose, 25-Aug-97, Hotels:  112.00
  12543.   San Jose, 25-Aug-97, Transport:  45.00
  12544.  ...
  12545.  
  12546. The browser could also speak the headers only when they change:
  12547.  
  12548. San Jose, 25-Aug-97, Meals: 37.74
  12549.     Hotels: 112.00
  12550.     Transport: 45.00
  12551.   26-Aug-97, Meals: 27.28
  12552.     Hotels: 112.00
  12553. ...
  12554.  
  12555.   ------------------------------------------------------------------------
  12556.   ------------------------------------------------------------------------
  12557.  
  12558.                               18 User interface
  12559.  
  12560. Contents
  12561.  
  12562.    * 18.1 Cursors: the 'cursor' property
  12563.    * 18.2 User preferences for colors
  12564.    * 18.3 User preferences for fonts
  12565.    * 18.4 Dynamic outlines: the 'outline' property
  12566.         o 18.4.1 Outlines and the focus
  12567.    * 18.5 Magnification
  12568.  
  12569. 18.1 Cursors: the 'cursor' property
  12570.  
  12571. 'cursor'
  12572.      Value:         [ [<uri> ,]* [ auto | crosshair | default | pointer |
  12573.                     move | e-resize | ne-resize | nw-resize | n-resize |
  12574.                     se-resize | sw-resize | s-resize | w-resize| text | wait
  12575.                     | help ] ] | inherit
  12576.      Initial:       auto
  12577.      Applies to:    all elements
  12578.      Inherited:     yes
  12579.      Percentages:   N/A
  12580.      Media:         visual, interactive
  12581.  
  12582. This property specifies the type of cursor to be displayed for the pointing
  12583. device. Values have the following meanings:
  12584.  
  12585. auto
  12586.      The UA determines the cursor to display based on the current context.
  12587. crosshair
  12588.      A simple crosshair (e.g., short line segments resembling a "+" sign).
  12589. default
  12590.      The platform-dependent default cursor. Often rendered as an arrow.
  12591. pointer
  12592.      The cursor is a pointer that indicates a link.
  12593. move
  12594.      Indicates something is to be moved.
  12595. e-resize, ne-resize, nw-resize, n-resize, se-resize, sw-resize, s-resize,
  12596. w-resize
  12597.      Indicate that some edge is to be moved. For example, the 'se-resize'
  12598.      cursor is used when the movement starts from the south-east corner of
  12599.      the box.
  12600. text
  12601.      Indicates text that may be selected. Often rendered as an I-bar.
  12602. wait
  12603.      Indicates that the program is busy and the user should wait. Often
  12604.      rendered as a watch or hourglass.
  12605. help
  12606.      Help is available for the object under the cursor. Often rendered as a
  12607.      question mark or a balloon.
  12608. <uri>
  12609.      The user agent retrieves the cursor from the resource designated by the
  12610.      URI. If the user agent cannot handle the first cursor of a list of
  12611.      cursors, it should attempt to handle the second, etc. If the user agent
  12612.      cannot handle any user-defined cursor, it must use the generic cursor
  12613.      at the end of the list.
  12614.  
  12615. Example(s):
  12616.  
  12617. P { cursor : url("mything.cur"), url("second.csr"), text; }
  12618.  
  12619. 18.2 User preferences for colors
  12620.  
  12621. In addition to being able to assign pre-defined color values to text,
  12622. backgrounds, etc., CSS2 allows authors to specify colors in a manner that
  12623. integrates them into the user's graphic environment. Style rules that take
  12624. into account user preferences thus offer the following advantages:
  12625.  
  12626.   1. They produce pages that fit the user's defined look and feel.
  12627.   2. They produce pages that may be more accessible as the current user
  12628.      settings may be related to a disability.
  12629.  
  12630. The set of values defined for system colors is intended to be exhaustive.
  12631. For systems that do not have a corresponding value, the specified value
  12632. should be mapped to the nearest system attribute, or to a default color.
  12633.  
  12634. The following lists additional values for color-related CSS attributes and
  12635. their general meaning. Any color property (e.g., 'color' or
  12636. 'background-color') can take one of the following names. Although these are
  12637. case-insensitive, it is recommended that the mixed capitalization shown
  12638. below be used, to make the names more legible.
  12639.  
  12640. ActiveBorder
  12641.      Active window border.
  12642. ActiveCaption
  12643.      Active window caption.
  12644. AppWorkspace
  12645.      Background color of multiple document interface.
  12646. Background
  12647.      Desktop background.
  12648. ButtonFace
  12649.      Face color for three-dimensional display elements.
  12650. ButtonHighlight
  12651.      Dark shadow for three-dimensional display elements (for edges facing
  12652.      away from the light source).
  12653. ButtonShadow
  12654.      Shadow color for three-dimensional display elements.
  12655. ButtonText
  12656.      Text on push buttons.
  12657. CaptionText
  12658.      Text in caption, size box, and scrollbar arrow box.
  12659. GrayText
  12660.      Grayed (disabled) text. This color is set to #000 if the current
  12661.      display driver does not support a solid gray color.
  12662. Highlight
  12663.      Item(s) selected in a control.
  12664. HighlightText
  12665.      Text of item(s) selected in a control.
  12666. InactiveBorder
  12667.      Inactive window border.
  12668. InactiveCaption
  12669.      Inactive window caption.
  12670. InactiveCaptionText
  12671.      Color of text in an inactive caption.
  12672. InfoBackground
  12673.      Background color for tooltip controls.
  12674. InfoText
  12675.      Text color for tooltip controls.
  12676. Menu
  12677.      Menu background.
  12678. MenuText
  12679.      Text in menus.
  12680. Scrollbar
  12681.      Scroll bar gray area.
  12682. ThreeDDarkShadow
  12683.      Dark shadow for three-dimensional display elements.
  12684. ThreeDFace
  12685.      Face color for three-dimensional display elements.
  12686. ThreeDHighlight
  12687.      Highlight color for three-dimensional display elements.
  12688. ThreeDLightShadow
  12689.      Light color for three-dimensional display elements (for edges facing
  12690.      the light source).
  12691. ThreeDShadow
  12692.      Dark shadow for three-dimensional display elements.
  12693. Window
  12694.      Window background.
  12695. WindowFrame
  12696.      Window frame.
  12697. WindowText
  12698.      Text in windows.
  12699.  
  12700. Example(s):
  12701.  
  12702. For example, to set the foreground and background colors of a paragraph to
  12703. the same foreground and background colors of the user's window, write the
  12704. following:
  12705.  
  12706. P { color: WindowText; background-color: Window }
  12707.  
  12708. 18.3 User preferences for fonts
  12709.  
  12710. As for colors, authors may specify fonts in a way that makes use of a user's
  12711. system resources. Please consult the 'font' property for details.
  12712.  
  12713. 18.4 Dynamic outlines: the 'outline' property
  12714.  
  12715. At times, style sheet authors may want to create outlines around visual
  12716. objects such as buttons, active form fields, image maps, etc., to make them
  12717. stand out. CSS2 outlines differ from borders in the following ways:
  12718.  
  12719.   1. Outlines do not take up space.
  12720.   2. Outlines may be non-rectangular.
  12721.  
  12722. The outline properties control the style of these dynamic outlines.
  12723.  
  12724. 'outline'
  12725.      Value:         [ <'outline-color'> || <'outline-style'> ||
  12726.                     <'outline-width'> ] | inherit
  12727.      Initial:       see individual properties
  12728.      Applies to:    all elements
  12729.      Inherited:     no
  12730.      Percentages:   N/A
  12731.      Media:         visual, interactive
  12732.  
  12733. 'outline-width'
  12734.      Value:         <border-width> | inherit
  12735.      Initial:       medium
  12736.      Applies to:    all elements
  12737.      Inherited:     no
  12738.      Percentages:   N/A
  12739.      Media:         visual, interactive
  12740.  
  12741. 'outline-style'
  12742.      Value:         <border-style> | inherit
  12743.      Initial:       none
  12744.      Applies to:    all elements
  12745.      Inherited:     no
  12746.      Percentages:   N/A
  12747.      Media:         visual, interactive
  12748.  
  12749. 'outline-color'
  12750.      Value:         <color> | invert | inherit
  12751.      Initial:       invert
  12752.      Applies to:    all elements
  12753.      Inherited:     no
  12754.      Percentages:   N/A
  12755.      Media:         visual, interactive
  12756.  
  12757. The outline created with the outline properties is drawn "over" a box, i.e.,
  12758. the outline is always on top, and doesn't influence the position or size of
  12759. the box, or of any other boxes. Therefore, displaying or suppressing
  12760. outlines does not cause reflow.
  12761.  
  12762. The outline is drawn starting just outside the border edge.
  12763.  
  12764. Outlines may be non-rectangular. For example, if the element is broken
  12765. across several lines, the outline is the minimum outline that encloses all
  12766. the element's boxes. In contrast to borders, the outline is not open at the
  12767. line box's end or start, but is always fully connected.
  12768.  
  12769. The 'outline-width' property accepts the same values as 'border-width'.
  12770.  
  12771. The 'outline-style' property accepts the same values as 'border-style',
  12772. except that 'hidden' is not a legal outline style.
  12773.  
  12774. The 'outline-color' accepts all colors, as well as the keyword 'invert'.
  12775. 'Invert' is expected to perform a color inversion on the pixels on the
  12776. screen. This is a common trick to ensure the focus border is visible,
  12777. regardless of color background.
  12778.  
  12779. The 'outline' property is a shorthand property, and sets all three of
  12780. 'outline-style', 'outline-width', and 'outline-color'.
  12781.  
  12782. Note that the outline is the same on all sides. In contrast to borders,
  12783. there is no 'outline-top' or 'outline-left' property.
  12784.  
  12785. This specification does not define how multiple overlapping outlines are
  12786. drawn, or how outlines are drawn for boxes that are partially obscured
  12787. behind other elements.
  12788.  
  12789. Note. Since the focus outline does not affect formatting (i.e., no space is
  12790. left for it in the box model), it may well overlap other elements on the
  12791. page.
  12792.  
  12793. Example(s):
  12794.  
  12795. Here's an example of drawing a thick outline around a BUTTON element:
  12796.  
  12797. BUTTON { outline-width : thick }
  12798.  
  12799. Scripts may be used to dynamically change the width of the outline, without
  12800. provoking reflow.
  12801.  
  12802. 18.4.1 Outlines and the focus
  12803.  
  12804. Graphical user interfaces may use outlines around elements to tell the user
  12805. which element on the page has the focus. These outlines are in addition to
  12806. any borders, and switching outlines on and off should not cause the document
  12807. to reflow. The focus is the subject of user interaction in a document (e.g.,
  12808. for entering text, selecting a button, etc.). User agents supporting the
  12809. interactive media group must keep track of where the focus lies and must
  12810. also represent the focus. This may be done by using dynamic outlines in
  12811. conjunction with the :focus pseudo-class.
  12812.  
  12813. Example(s):
  12814.  
  12815. For example, to draw a thick black line around an element when it has the
  12816. focus, and a thick red line when it is active, the following rules can be
  12817. used:
  12818.  
  12819. :focus  { outline: thick solid black }
  12820. :active { outline: thick solid red }
  12821.  
  12822. 18.5 Magnification
  12823.  
  12824. The CSS working group considers that the magnification of a document or
  12825. portions of a document should not be specified through style sheets. User
  12826. agents may support such magnification in different ways (e.g., larger
  12827. images, louder sounds, etc.)
  12828.  
  12829. When magnifying a page, UAs should preserve the relationships between
  12830. positioned elements. For example, a comic strip may be composed of images
  12831. with overlaid text elements. When magnifying this page, a user agent should
  12832. keep the text within the comic strip balloon.
  12833.   ------------------------------------------------------------------------
  12834.   ------------------------------------------------------------------------
  12835.  
  12836.                             19 Aural style sheets
  12837.  
  12838. Contents
  12839.  
  12840.    * 19.1 Introduction to aural style sheets
  12841.    * 19.2 Volume properties: 'volume'
  12842.    * 19.3 Speaking properties: 'speak'
  12843.    * 19.4 Pause properties: 'pause-before', 'pause-after', and 'pause'
  12844.    * 19.5 Cue properties: 'cue-before', 'cue-after', and 'cue'
  12845.    * 19.6 Mixing properties: 'play-during'
  12846.    * 19.7 Spatial properties: 'azimuth' and 'elevation'
  12847.    * 19.8 Voice characteristic properties: 'speech-rate', 'voice-family',
  12848.      'pitch', 'pitch-range', 'stress', and 'richness'
  12849.    * 19.9 Speech properties: 'speak-punctuation' and 'speak-numeral'
  12850.  
  12851. 19.1 Introduction to aural style sheets
  12852.  
  12853. The aural rendering of a document, already commonly used by the blind and
  12854. print-impaired communities, combines speech synthesis and "auditory icons."
  12855. Often such aural presentation occurs by converting the document to plain
  12856. text and feeding this to a screen reader -- software or hardware that simply
  12857. reads all the characters on the screen. This results in less effective
  12858. presentation than would be the case if the document structure were retained.
  12859. Style sheet properties for aural presentation may be used together with
  12860. visual properties (mixed media) or as an aural alternative to visual
  12861. presentation.
  12862.  
  12863. Besides the obvious accessibility advantages, there are other large markets
  12864. for listening to information, including in-car use, industrial and medical
  12865. documentation systems (intranets), home entertainment, and to help users
  12866. learning to read or who have difficulty reading.
  12867.  
  12868. When using aural properties, the canvas consists of a three-dimensional
  12869. physical space (sound surrounds) and a temporal space (one may specify
  12870. sounds before, during, and after other sounds). The CSS properties also
  12871. allow authors to vary the quality of synthesized speech (voice type,
  12872. frequency, inflection, etc.).
  12873.  
  12874. Example(s):
  12875.  
  12876. H1, H2, H3, H4, H5, H6 {
  12877.     voice-family: paul;
  12878.     stress: 20;
  12879.     richness: 90;
  12880.     cue-before: url("ping.au")
  12881. }
  12882. P.heidi { azimuth: center-left }
  12883. P.peter { azimuth: right }
  12884. P.goat  { volume: x-soft }
  12885.  
  12886. This will direct the speech synthesizer to speak headers in a voice (a kind
  12887. of "audio font") called "paul", on a flat tone, but in a very rich voice.
  12888. Before speaking the headers, a sound sample will be played from the given
  12889. URL. Paragraphs with class "heidi" will appear to come from front left (if
  12890. the sound system is capable of spatial audio), and paragraphs of class
  12891. "peter" from the right. Paragraphs with class "goat" will be very soft.
  12892.  
  12893. 19.2 Volume properties: 'volume'
  12894.  
  12895. 'volume'
  12896.      Value:         <number> | <percentage> | silent | x-soft | soft |
  12897.                     medium | loud | x-loud | inherit
  12898.      Initial:       medium
  12899.      Applies to:    all elements
  12900.      Inherited:     yes
  12901.      Percentages:   refer to inherited value
  12902.      Media:         aural
  12903.  
  12904. Volume refers to the median volume of the waveform. In other words, a highly
  12905. inflected voice at a volume of 50 might peak well above that. The overall
  12906. values are likely to be human adjustable for comfort, for example with a
  12907. physical volume control (which would increase both the 0 and 100 values
  12908. proportionately); what this property does is adjust the dynamic range.
  12909.  
  12910. Values have the following meanings:
  12911.  
  12912. <number>
  12913.      Any number between '0' and '100'. '0' represents the minimum audible
  12914.      volume level and 100 corresponds to the maximum comfortable level.
  12915. <percentage>
  12916.      Percentage values are calculated relative to the inherited value, and
  12917.      are then clipped to the range '0' to '100'.
  12918. silent
  12919.      No sound at all. The value '0' does not mean the same as 'silent'.
  12920. x-soft
  12921.      Same as '0'.
  12922. soft
  12923.      Same as '25'.
  12924. medium
  12925.      Same as '50'.
  12926. loud
  12927.      Same as '75'.
  12928. x-loud
  12929.      Same as '100'.
  12930.  
  12931. User agents should allow the values corresponding to '0' and '100' to be set
  12932. by the listener. No one setting is universally applicable; suitable values
  12933. depend on the equipment in use (speakers, headphones), the environment (in
  12934. car, home theater, library) and personal preferences. Some examples:
  12935.  
  12936.    * A browser for in-car use has a setting for when there is lots of
  12937.      background noise. '0' would map to a fairly high level and '100' to a
  12938.      quite high level. The speech is easily audible over the road noise but
  12939.      the overall dynamic range is compressed. Cars with better insulation
  12940.      might allow a wider dynamic range.
  12941.    * Another speech browser is being used in an apartment, late at night, or
  12942.      in a shared study room. '0' is set to a very quiet level and '100' to a
  12943.      fairly quiet level, too. As with the first example, there is a low
  12944.      slope; the dynamic range is reduced. The actual volumes are low here,
  12945.      whereas they were high in the first example.
  12946.    * In a quiet and isolated house, an expensive hi-fi home theater setup.
  12947.      '0' is set fairly low and '100' to quite high; there is wide dynamic
  12948.      range.
  12949.  
  12950. The same author style sheet could be used in all cases, simply by mapping
  12951. the '0' and '100' points suitably at the client side.
  12952.  
  12953. 19.3 Speaking properties: 'speak'
  12954.  
  12955. 'speak'
  12956.      Value:         normal | none | spell-out | inherit
  12957.      Initial:       normal
  12958.      Applies to:    all elements
  12959.      Inherited:     yes
  12960.      Percentages:   N/A
  12961.      Media:         aural
  12962.  
  12963. This property specifies whether text will be rendered aurally and if so, in
  12964. what manner (somewhat analogous to the 'display' property). The possible
  12965. values are:
  12966.  
  12967. none
  12968.      Suppresses aural rendering so that the element requires no time to
  12969.      render. Note, however, that descendants may override this value and
  12970.      will be spoken. (To be sure to suppress rendering of an element and its
  12971.      descendants, use the 'display' property).
  12972. normal
  12973.      Uses language-dependent pronunciation rules for rendering an element
  12974.      and its children.
  12975. spell-out
  12976.      Spells the text one letter at a time (useful for acronyms and
  12977.      abbreviations).
  12978.  
  12979. Note the difference between an element whose 'volume' property has a value
  12980. of 'silent' and an element whose 'speak' property has the value 'none'. The
  12981. former takes up the same time as if it had been spoken, including any pause
  12982. before and after the element, but no sound is generated. The latter requires
  12983. no time and is not rendered (though its descendants may be).
  12984.  
  12985. 19.4 Pause properties: 'pause-before', 'pause-after', and 'pause'
  12986.  
  12987. 'pause-before'
  12988.      Value:         <time> | <percentage> | inherit
  12989.      Initial:       depends on user agent
  12990.      Applies to:    all elements
  12991.      Inherited:     no
  12992.      Percentages:   see prose
  12993.      Media:         aural
  12994.  
  12995. 'pause-after'
  12996.      Value:         <time> | <percentage> | inherit
  12997.      Initial:       depends on user agent
  12998.      Applies to:    all elements
  12999.      Inherited:     no
  13000.      Percentages:   see prose
  13001.      Media:         aural
  13002.  
  13003. These properties specify a pause to be observed before (or after) speaking
  13004. an element's content. Values have the following meanings:
  13005.  
  13006. <time>
  13007.      Expresses the pause in absolute time units (seconds and milliseconds).
  13008. <percentage>
  13009.      Refers to the inverse of the value of the 'speech-rate' property. For
  13010.      example, if the speech-rate is 120 words per minute (i.e., a word takes
  13011.      half a second, or 500ms) then a 'pause-before' of 100% means a pause of
  13012.      500 ms and a 'pause-before' of 20% means 100ms.
  13013.  
  13014. The pause is inserted between the element's content and any 'cue-before' or
  13015. 'cue-after' content.
  13016.  
  13017. Authors should use relative units to create more robust style sheets in the
  13018. face of large changes in speech-rate.
  13019.  
  13020. 'pause'
  13021.      Value:         [ [<time> | <percentage>]{1,2} ] | inherit
  13022.      Initial:       depends on user agent
  13023.      Applies to:    all elements
  13024.      Inherited:     no
  13025.      Percentages:   see descriptions of 'pause-before' and 'pause-after'
  13026.      Media:         aural
  13027.  
  13028. The 'pause' property is a shorthand for setting 'pause-before' and
  13029. 'pause-after'. If two values are given, the first value is 'pause-before'
  13030. and the second is 'pause-after'. If only one value is given, it applies to
  13031. both properties.
  13032.  
  13033. Example(s):
  13034.  
  13035. H1 { pause: 20ms } /* pause-before: 20ms; pause-after: 20ms */
  13036. H2 { pause: 30ms 40ms } /* pause-before: 30ms; pause-after: 40ms */
  13037. H3 { pause-after: 10ms } /* pause-before: ?; pause-after: 10ms */
  13038.  
  13039. 19.5 Cue properties: 'cue-before', 'cue-after', and 'cue'
  13040.  
  13041. 'cue-before'
  13042.      Value:         <uri> | none | inherit
  13043.      Initial:       none
  13044.      Applies to:    all elements
  13045.      Inherited:     no
  13046.      Percentages:   N/A
  13047.      Media:         aural
  13048.  
  13049. 'cue-after'
  13050.      Value:         <uri> | none | inherit
  13051.      Initial:       none
  13052.      Applies to:    all elements
  13053.      Inherited:     no
  13054.      Percentages:   N/A
  13055.      Media:         aural
  13056.  
  13057. Auditory icons are another way to distinguish semantic elements. Sounds may
  13058. be played before and/or after the element to delimit it. Values have the
  13059. following meanings:
  13060.  
  13061. <uri>
  13062.      The URI must designate an auditory icon resource. If the URI resolves
  13063.      to something other than an audio file, such as an image, the resource
  13064.      should be ignored and the property treated as if it had the value
  13065.      'none'.
  13066. none
  13067.      No auditory icon is specified.
  13068.  
  13069. Example(s):
  13070.  
  13071. A {cue-before: url("bell.aiff"); cue-after: url("dong.wav") }
  13072. H1 {cue-before: url("pop.au"); cue-after: url("pop.au") }
  13073.  
  13074. 'cue'
  13075.      Value:         [ <'cue-before'> || <'cue-after'> ] | inherit
  13076.      Initial:       not defined for shorthand properties
  13077.      Applies to:    all elements
  13078.      Inherited:     no
  13079.      Percentages:   N/A
  13080.      Media:         aural
  13081.  
  13082. The 'cue' property is a shorthand for setting 'cue-before' and 'cue-after'.
  13083. If two values are given, the first value is 'cue-before' and the second is
  13084. 'cue-after'. If only one value is given, it applies to both properties.
  13085.  
  13086. Example(s):
  13087.  
  13088. The following two rules are equivalent:
  13089.  
  13090. H1 {cue-before: url("pop.au"); cue-after: url("pop.au") }
  13091. H1 {cue: url("pop.au") }
  13092.  
  13093. If a user agent cannot render an auditory icon (e.g., the user's environment
  13094. does not permit it), we recommend that it produce an alternative cue (e.g.,
  13095. popping up a warning, emitting a warning sound, etc.)
  13096.  
  13097. Please see the sections on the :before and :after pseudo-elements for
  13098. information on other content generation techniques.
  13099.  
  13100. 19.6 Mixing properties: 'play-during'
  13101.  
  13102. 'play-during'
  13103.      Value:         <uri> mix? repeat? | auto | none | inherit
  13104.      Initial:       auto
  13105.      Applies to:    all elements
  13106.      Inherited:     no
  13107.      Percentages:   N/A
  13108.      Media:         aural
  13109.  
  13110. Similar to the 'cue-before' and 'cue-after' properties, this property
  13111. specifies a sound to be played as a background while an element's content is
  13112. spoken. Values have the following meanings:
  13113.  
  13114. <uri>
  13115.      The sound designated by this <uri> is played as a background while the
  13116.      element's content is spoken.
  13117. mix
  13118.      When present, this keyword means that the sound inherited from the
  13119.      parent element's 'play-during' property continues to play and the sound
  13120.      designated by the <uri> is mixed with it. If 'mix' is not specified,
  13121.      the element's background sound replaces the parent's.
  13122. repeat
  13123.      When present, this keyword means that the sound will repeat if it is
  13124.      too short to fill the entire duration of the element. Otherwise, the
  13125.      sound plays once and then stops. This is similar to the
  13126.      'background-repeat' property. If the sound is too long for the element,
  13127.      it is clipped once the element has been spoken.
  13128. auto
  13129.      The sound of the parent element continues to play (it is not restarted,
  13130.      which would have been the case if this property had been inherited).
  13131. none
  13132.      This keyword means that there is silence. The sound of the parent
  13133.      element (if any) is silent during the current element and continues
  13134.      after the current element.
  13135.  
  13136. Example(s):
  13137.  
  13138. BLOCKQUOTE.sad { play-during: url("violins.aiff") }
  13139. BLOCKQUOTE Q   { play-during: url("harp.wav") mix }
  13140. SPAN.quiet     { play-during: none }
  13141.  
  13142. 19.7 Spatial properties: 'azimuth' and 'elevation'
  13143.  
  13144. Spatial audio is an important stylistic property for aural presentation. It
  13145. provides a natural way to tell several voices apart, as in real life (people
  13146. rarely all stand in the same spot in a room). Stereo speakers produce a
  13147. lateral sound stage. Binaural headphones or the increasingly popular
  13148. 5-speaker home theater setups can generate full surround sound, and
  13149. multi-speaker setups can create a true three-dimensional sound stage. VRML
  13150. 2.0 also includes spatial audio, which implies that in time consumer-priced
  13151. spatial audio hardware will become more widely available.
  13152.  
  13153. 'azimuth'
  13154.      Value:         <angle> | [[ left-side | far-left | left | center-left |
  13155.                     center | center-right | right | far-right | right-side ]
  13156.                     || behind ] | leftwards | rightwards | inherit
  13157.      Initial:       center
  13158.      Applies to:    all elements
  13159.      Inherited:     yes
  13160.      Percentages:   N/A
  13161.      Media:         aural
  13162.  
  13163. Values have the following meanings:
  13164.  
  13165. <angle>
  13166.      Position is described in terms of an angle within the range '-360deg'
  13167.      to '360deg'. The value '0deg' means directly ahead in the center of the
  13168.      sound stage. '90deg' is to the right, '180deg' behind, and '270deg'
  13169.      (or, equivalently and more conveniently, '-90deg') to the left.
  13170. left-side
  13171.      Same as '270deg'. With 'behind', '270deg'.
  13172. far-left
  13173.      Same as '300deg'. With 'behind', '240deg'.
  13174. left
  13175.      Same as '320deg'. With 'behind', '220deg'.
  13176. center-left
  13177.      Same as '340deg'. With 'behind', '200deg'.
  13178. center
  13179.      Same as '0deg'. With 'behind', '180deg'.
  13180. center-right
  13181.      Same as '20deg'. With 'behind', '160deg'.
  13182. right
  13183.      Same as '40deg'. With 'behind', '140deg'.
  13184. far-right
  13185.      Same as '60deg'. With 'behind', '120deg'.
  13186. right-side
  13187.      Same as '90deg'. With 'behind', '90deg'.
  13188. leftwards
  13189.      Moves the sound to the left, relative to the current angle. More
  13190.      precisely, subtracts 20 degrees. Arithmetic is carried out modulo 360
  13191.      degrees. Note that 'leftwards' is more accurately described as "turned
  13192.      counter-clockwise," since it always subtracts 20 degrees, even if the
  13193.      inherited azimuth is already behind the listener (in which case the
  13194.      sound actually appears to move to the right).
  13195. rightwards
  13196.      Moves the sound to the right, relative to the current angle. More
  13197.      precisely, adds 20 degrees. See 'leftwards' for arithmetic.
  13198.  
  13199. This property is most likely to be implemented by mixing the same signal
  13200. into different channels at differing volumes. It might also use phase
  13201. shifting, digital delay, and other such techniques to provide the illusion
  13202. of a sound stage. The precise means used to achieve this effect and the
  13203. number of speakers used to do so are user agent-dependent; this property
  13204. merely identifies the desired end result.
  13205.  
  13206. Example(s):
  13207.  
  13208. H1   { azimuth: 30deg }
  13209. TD.a { azimuth: far-right }          /*  60deg */
  13210. #12  { azimuth: behind far-right }   /* 120deg */
  13211. P.comment { azimuth: behind }        /* 180deg */
  13212.  
  13213. If spatial-azimuth is specified and the output device cannot produce sounds
  13214. behind the listening position, user agents should convert values in the
  13215. rearwards hemisphere to forwards hemisphere values. One method is as
  13216. follows:
  13217.  
  13218.    * if 90deg < x <= 180deg then x := 180deg - x
  13219.    * if 180deg < x <= 270deg then x := 540deg - x
  13220.  
  13221. 'elevation'
  13222.      Value:         <angle> | below | level | above | higher | lower |
  13223.                     inherit
  13224.      Initial:       level
  13225.      Applies to:    all elements
  13226.      Inherited:     yes
  13227.      Percentages:   N/A
  13228.      Media:         aural
  13229.  
  13230. Values of this property have the following meanings:
  13231.  
  13232. <angle>
  13233.      Specifies the elevation as an angle, between '-90deg' and '90deg'.
  13234.      '0deg' means on the forward horizon, which loosely means level with the
  13235.      listener. '90deg' means directly overhead and '-90deg' means directly
  13236.      below.
  13237. below
  13238.      Same as '-90deg'.
  13239. level
  13240.      Same as '0deg'.
  13241. above
  13242.      Same as '90deg'.
  13243. higher
  13244.      Adds 10 degrees to the current elevation.
  13245. lower
  13246.      Subtracts 10 degrees from the current elevation.
  13247.  
  13248. The precise means used to achieve this effect and the number of speakers
  13249. used to do so are undefined. This property merely identifies the desired end
  13250. result.
  13251.  
  13252. Example(s):
  13253.  
  13254. H1   { elevation: above }
  13255. TR.a { elevation: 60deg }
  13256. TR.b { elevation: 30deg }
  13257. TR.c { elevation: level }
  13258.  
  13259. 19.8 Voice characteristic properties: 'speech-rate', 'voice-family',
  13260. 'pitch', 'pitch-range', 'stress', and 'richness'
  13261.  
  13262. 'speech-rate'
  13263.      Value:         <number> | x-slow | slow | medium | fast | x-fast |
  13264.                     faster | slower | inherit
  13265.      Initial:       medium
  13266.      Applies to:    all elements
  13267.      Inherited:     yes
  13268.      Percentages:   N/A
  13269.      Media:         aural
  13270.  
  13271. This property specifies the speaking rate. Note that both absolute and
  13272. relative keyword values are allowed (compare with 'font-size'). Values have
  13273. the following meanings:
  13274.  
  13275. <number>
  13276.      Specifies the speaking rate in words per minute, a quantity that varies
  13277.      somewhat by language but is nevertheless widely supported by speech
  13278.      synthesizers.
  13279. x-slow
  13280.      Same as 80 words per minute.
  13281. slow
  13282.      Same as 120 words per minute
  13283. medium
  13284.      Same as 180 - 200 words per minute.
  13285. fast
  13286.      Same as 300 words per minute.
  13287. x-fast
  13288.      Same as 500 words per minute.
  13289. faster
  13290.      Adds 40 words per minute to the current speech rate.
  13291. slower
  13292.      Subtracts 40 words per minutes from the current speech rate.
  13293.  
  13294. 'voice-family'
  13295.      Value:         [[<specific-voice> | <generic-voice> ],]*
  13296.                     [<specific-voice> | <generic-voice> ] | inherit
  13297.      Initial:       depends on user agent
  13298.      Applies to:    all elements
  13299.      Inherited:     yes
  13300.      Percentages:   N/A
  13301.      Media:         aural
  13302.  
  13303. The value is a comma-separated, prioritized list of voice family names
  13304. (compare with 'font-family'). Values have the following meanings:
  13305.  
  13306. <generic-voice>
  13307.      Values are voice families. Possible values are 'male', 'female', and
  13308.      'child'.
  13309. <specific-voice>
  13310.      Values are specific instances (e.g., comedian, trinoids, carlos, lani).
  13311.  
  13312. Example(s):
  13313.  
  13314. H1 { voice-family: announcer, male }
  13315. P.part.romeo  { voice-family: romeo, male }
  13316. P.part.juliet { voice-family: juliet, female }
  13317.  
  13318. Names of specific voices may be quoted, and indeed must be quoted if any of
  13319. the words that make up the name does not conform to the syntax rules for
  13320. identifiers. It is also recommended to quote specific voices with a name
  13321. consisting of more than one word. If quoting is omitted, any whitespace
  13322. characters before and after the font name are ignored and any sequence of
  13323. whitespace characters inside the font name is converted to a single space.
  13324.  
  13325. 'pitch'
  13326.      Value:         <frequency> | x-low | low | medium | high | x-high |
  13327.                     inherit
  13328.      Initial:       medium
  13329.      Applies to:    all elements
  13330.      Inherited:     yes
  13331.      Percentages:   N/A
  13332.      Media:         aural
  13333.  
  13334. Specifies the average pitch (a frequency) of the speaking voice. The average
  13335. pitch of a voice depends on the voice family. For example, the average pitch
  13336. for a standard male voice is around 120Hz, but for a female voice, it's
  13337. around 210Hz.
  13338.  
  13339. Values have the following meanings:
  13340.  
  13341. <frequency>
  13342.      Specifies the average pitch of the speaking voice in hertz (Hz).
  13343. x-low, low, medium, high, x-high
  13344.      These values do not map to absolute frequencies since these values
  13345.      depend on the voice family. User agents should map these values to
  13346.      appropriate frequencies based on the voice family and user environment.
  13347.      However, user agents must map these values in order (i.e., 'x-low' is a
  13348.      lower frequency than 'low', etc.).
  13349.  
  13350. 'pitch-range'
  13351.      Value:         <number> | inherit
  13352.      Initial:       50
  13353.      Applies to:    all elements
  13354.      Inherited:     yes
  13355.      Percentages:   N/A
  13356.      Media:         aural
  13357.  
  13358. Specifies variation in average pitch. The perceived pitch of a human voice
  13359. is determined by the fundamental frequency and typically has a value of
  13360. 120Hz for a male voice and 210Hz for a female voice. Human languages are
  13361. spoken with varying inflection and pitch; these variations convey additional
  13362. meaning and emphasis. Thus, a highly animated voice, i.e., one that is
  13363. heavily inflected, displays a high pitch range. This property specifies the
  13364. range over which these variations occur, i.e., how much the fundamental
  13365. frequency may deviate from the average pitch.
  13366.  
  13367. Values have the following meanings:
  13368.  
  13369. <number>
  13370.      A value between '0' and '100'. A pitch range of '0' produces a flat,
  13371.      monotonic voice. A pitch range of 50 produces normal inflection. Pitch
  13372.      ranges greater than 50 produce animated voices.
  13373.  
  13374. 'stress'
  13375.      Value:         <number> | inherit
  13376.      Initial:       50
  13377.      Applies to:    all elements
  13378.      Inherited:     yes
  13379.      Percentages:   N/A
  13380.      Media:         aural
  13381.  
  13382. Specifies the height of "local peaks" in the intonation contour of a voice.
  13383. For example, English is a stressed language, and different parts of a
  13384. sentence are assigned primary, secondary, or tertiary stress. The value of
  13385. 'stress' controls the amount of inflection that results from these stress
  13386. markers. This property is a companion to the 'pitch-range' property and is
  13387. provided to allow developers to exploit higher-end auditory displays.
  13388.  
  13389. Values have the following meanings:
  13390.  
  13391. <number>
  13392.      A value, between '0' and '100'. The meaning of values depends on the
  13393.      language being spoken. For example, a level of '50' for a standard,
  13394.      English-speaking male voice (average pitch = 122Hz), speaking with
  13395.      normal intonation and emphasis would have a different meaning than '50'
  13396.      for an Italian voice.
  13397.  
  13398. 'richness'
  13399.      Value:         <number> | inherit
  13400.      Initial:       50
  13401.      Applies to:    all elements
  13402.      Inherited:     yes
  13403.      Percentages:   N/A
  13404.      Media:         aural
  13405.  
  13406. Specifies the richness, or brightness, of the speaking voice. A rich voice
  13407. will "carry" in a large room, a smooth voice will not. (The term "smooth"
  13408. refers to how the wave form looks when drawn.)
  13409.  
  13410. Values have the following meanings:
  13411.  
  13412. <number>
  13413.      A value between '0' and '100'. The higher the value, the more the voice
  13414.      will carry. A lower value will produce a soft, mellifluous voice.
  13415.  
  13416. 19.9 Speech properties: 'speak-punctuation' and 'speak-numeral'
  13417.  
  13418. An additional speech property, speak-header, is described in the chapter on
  13419. tables
  13420.  
  13421. 'speak-punctuation'
  13422.      Value:         code | none | inherit
  13423.      Initial:       none
  13424.      Applies to:    all elements
  13425.      Inherited:     yes
  13426.      Percentages:   N/A
  13427.      Media:         aural
  13428.  
  13429. This property specifies how punctuation is spoken. Values have the following
  13430. meanings:
  13431.  
  13432. code
  13433.      Punctuation such as semicolons, braces, and so on are to be spoken
  13434.      literally.
  13435. none
  13436.      Punctuation is not to be spoken, but instead rendered naturally as
  13437.      various pauses.
  13438.  
  13439. 'speak-numeral'
  13440.      Value:         digits | continuous | inherit
  13441.      Initial:       continuous
  13442.      Applies to:    all elements
  13443.      Inherited:     yes
  13444.      Percentages:   N/A
  13445.      Media:         aural
  13446.  
  13447. This property controls how numerals are spoken. Values have the following
  13448. meanings:
  13449.  
  13450. digits
  13451.      Speak the numeral as individual digits. Thus, "237" is spoken "Two
  13452.      Three Seven".
  13453. continuous
  13454.      Speak the numeral as a full number. Thus, "237" is spoken "Two hundred
  13455.      thirty seven". Word representations are language-dependent.
  13456.  
  13457.   ------------------------------------------------------------------------
  13458.   ------------------------------------------------------------------------
  13459.  
  13460.                 Appendix A. A sample style sheet for HTML 4.0
  13461.  
  13462. This appendix is informative, not normative.
  13463.  
  13464. This style sheet describes the typical formatting of all HTML 4.0 ([HTML40])
  13465. elements based on extensive research into current UA practice. Developers
  13466. are encouraged to use it as a default style sheet in their implementations.
  13467.  
  13468. The full presentation of some HTML elements cannot be expressed in CSS2,
  13469. including replaced elements (IMG, OBJECT), scripting elements (SCRIPT,
  13470. APPLET), form control elements, and frame elements.
  13471.  
  13472. ADDRESS,
  13473. BLOCKQUOTE,
  13474. BODY, DD, DIV,
  13475. DL, DT,
  13476. FIELDSET, FORM,
  13477. FRAME, FRAMESET,
  13478. H1, H2, H3, H4,
  13479. H5, H6, IFRAME,
  13480. NOFRAMES,
  13481. OBJECT, OL, P,
  13482. UL, APPLET,
  13483. CENTER, DIR,
  13484. HR, MENU, PRE   { display: block }
  13485. LI              { display: list-item }
  13486. HEAD            { display: none }
  13487. TABLE           { display: table }
  13488. TR              { display: table-row }
  13489. THEAD           { display: table-header-group }
  13490. TBODY           { display: table-row-group }
  13491. TFOOT           { display: table-footer-group }
  13492. COL             { display: table-column }
  13493. COLGROUP        { display: table-column-group }
  13494. TD, TH          { display: table-cell }
  13495. CAPTION         { display: table-caption }
  13496. TH              { font-weight: bolder; text-align: center }
  13497. CAPTION         { text-align: center }
  13498. BODY            { padding: 8px; line-height: 1.33 }
  13499. H1              { font-size: 2em; margin: .67em 0 }
  13500. H2              { font-size: 1.5em; margin: .83em 0 }
  13501. H3              { font-size: 1.17em; margin: 1em 0 }
  13502. H4, P,
  13503. BLOCKQUOTE, UL,
  13504. FIELDSET, FORM,
  13505. OL, DL, DIR,
  13506. MENU            { margin: 1.33em 0 }
  13507. H5              { font-size: .83em; line-height: 1.17em; margin: 1.67em 0 }
  13508. H6              { font-size: .67em; margin: 2.33em 0 }
  13509. H1, H2, H3, H4,
  13510. H5, H6, B,
  13511. STRONG          { font-weight: bolder }
  13512. BLOCKQUOTE      { margin-left: 40px; margin-right: 40px }
  13513. I, CITE, EM,
  13514. VAR, ADDRESS    { font-style: italic }
  13515. PRE, TT, CODE,
  13516. KBD, SAMP       { font-family: monospace }
  13517. PRE             { white-space: pre }
  13518. BIG             { font-size: 1.17em }
  13519. SMALL, SUB, SUP { font-size: .83em }
  13520. SUB             { vertical-align: sub }
  13521. SUP             { vertical-align: super }
  13522. S, STRIKE, DEL  { text-decoration: line-through }
  13523. HR              { border: 1px inset }
  13524. OL, UL, DIR,
  13525. MENU, DD        { margin-left: 40px }
  13526. OL              { list-style-type: decimal }
  13527. OL UL, UL OL,
  13528. UL UL, OL OL    { margin-top: 0; margin-bottom: 0 }
  13529. U, INS          { text-decoration: underline }
  13530. CENTER          { text-align: center }
  13531. BR:before       { content: "\A" }
  13532.  
  13533. /* An example of style for HTML 4.0's ABBR/ACRONYM elements */
  13534.  
  13535. ABBR, ACRONYM   { font-variant: small-caps; letter-spacing: 0.1em }
  13536. A[href]         { text-decoration: underline }
  13537. :focus          { outline: thin dotted invert }
  13538.  
  13539. /* Begin bidirectionality settings (do not change) */
  13540. BDO[DIR="ltr"]  { direction: ltr; unicode-bidi: bidi-override }
  13541. BDO[DIR="rtl"]  { direction: rtl; unicode-bidi: bidi-override }
  13542.  
  13543. *[DIR="ltr"]    { direction: ltr; unicode-bidi: embed }
  13544. *[DIR="rtl"]    { direction: rtl; unicode-bidi: embed }
  13545.  
  13546. /* Elements that are block-level in HTML4 */
  13547. ADDRESS, BLOCKQUOTE, BODY, DD, DIV, DL, DT, FIELDSET,
  13548. FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, IFRAME,
  13549. NOSCRIPT, NOFRAMES, OBJECT, OL, P, UL, APPLET, CENTER,
  13550. DIR, HR, MENU, PRE, LI, TABLE, TR, THEAD, TBODY, TFOOT,
  13551. COL, COLGROUP, TD, TH, CAPTION
  13552.                 { unicode-bidi: embed }
  13553. /* End bidi settings */
  13554.  
  13555. @media print {
  13556.   @page         { margin: 10% }
  13557.   H1, H2, H3,
  13558.   H4, H5, H6    { page-break-after: avoid; page-break-inside: avoid }
  13559.   BLOCKQUOTE,
  13560.   PRE           { page-break-inside: avoid }
  13561.   UL, OL, DL    { page-break-before: avoid }
  13562. }
  13563.  
  13564. @media speech {
  13565.   H1, H2, H3,
  13566.   H4, H5, H6    { voice-family: paul, male; stress: 20; richness: 90 }
  13567.   H1            { pitch: x-low; pitch-range: 90 }
  13568.   H2            { pitch: x-low; pitch-range: 80 }
  13569.   H3            { pitch: low; pitch-range: 70 }
  13570.   H4            { pitch: medium; pitch-range: 60 }
  13571.   H5            { pitch: medium; pitch-range: 50 }
  13572.   H6            { pitch: medium; pitch-range: 40 }
  13573.   LI, DT, DD    { pitch: medium; richness: 60 }
  13574.   DT            { stress: 80 }
  13575.   PRE, CODE, TT { pitch: medium; pitch-range: 0; stress: 0; richness: 80 }
  13576.   EM            { pitch: medium; pitch-range: 60; stress: 60; richness: 50 }
  13577.   STRONG        { pitch: medium; pitch-range: 60; stress: 90; richness: 90 }
  13578.   DFN           { pitch: high; pitch-range: 60; stress: 60 }
  13579.   S, STRIKE     { richness: 0 }
  13580.   I             { pitch: medium; pitch-range: 60; stress: 60; richness: 50 }
  13581.   B             { pitch: medium; pitch-range: 60; stress: 90; richness: 90 }
  13582.   U             { richness: 0 }
  13583.   A:link        { voice-family: harry, male }
  13584.   A:visited     { voice-family: betty, female }
  13585.   A:active      { voice-family: betty, female; pitch-range: 80; pitch: x-high }
  13586. }
  13587.  
  13588.   ------------------------------------------------------------------------
  13589.   ------------------------------------------------------------------------
  13590.  
  13591.                         Appendix B. Changes from CSS1
  13592.  
  13593. Contents
  13594.  
  13595.    * B.1 New functionality
  13596.    * B.2 Updated descriptions
  13597.    * B.3 Semantic changes from CSS1
  13598.  
  13599. This appendix is informative, not normative.
  13600.  
  13601. CSS2 builds on CSS1 and all valid CSS1 style sheets are valid CSS2 style
  13602. sheets. The changes between the CSS1 specification (see [CSS1]) and this
  13603. specification fall into three groups: new functionality, updated
  13604. descriptions of CSS1 functionality, and changes to CSS1.
  13605.  
  13606. B.1 New functionality
  13607.  
  13608. In addition to the functionality of CSS1, CSS2 supports:
  13609.  
  13610.    * The concept of media types.
  13611.    * The 'inherit' value for all properties.
  13612.    * Paged media
  13613.    * Aural style sheets
  13614.    * Several internationalization features, including list numbering styles,
  13615.      support for bidirectional text, and support for language-sensitive
  13616.      quotation marks.
  13617.    * An extended font selection mechanism, including intelligent matching,
  13618.      synthesis, and downloadable fonts. Also, the concept of system fonts
  13619.      has been is introduced, and a new property, 'font-size-adjust', has
  13620.      been added.
  13621.    * Tables, including new values on 'display' and 'vertical-align'.
  13622.    * Relative and absolute positioning, including fixed positioning.
  13623.    * New box types (along with block and inline): compact and run-in.
  13624.    * The ability to control content overflow, clipping, and visibility in
  13625.      the visual formatting model.
  13626.    * The ability to specify minimum and maximum widths and heights in the
  13627.      visual formatting model.
  13628.    * An extended selector mechanism, including child selectors, adjacent
  13629.      selectors, and attribute selectors.
  13630.    * Generated content, counters and automatic numbering, and markers.
  13631.    * Text shadows, through the new 'text-shadow' property.
  13632.    * Several new pseudo-classes, :first-child, :hover, :focus, :lang.
  13633.    * System colors and fonts.
  13634.    * Cursors.
  13635.    * Dynamic outlines.
  13636.  
  13637. B.2 Updated descriptions
  13638.  
  13639. The CSS1 specification was short and concise. This specification is much
  13640. more voluminous and more readable. Much of the additional content describes
  13641. new functionality, but the description of CSS1 features has also been
  13642. extended. Except in a few cases described below, the rewritten descriptions
  13643. do not indicate a change in syntax nor semantics.
  13644.  
  13645. B.3 Semantic changes from CSS1
  13646.  
  13647. While all CSS1 style sheets are valid CSS2 style sheets, there are a few
  13648. cases where the CSS1 style sheet will have a different meaning when
  13649. interpreted as a CSS2 style sheet. Most changes are due to implementation
  13650. experience feeding back into the specification, but there are also some
  13651. error corrections.
  13652.  
  13653.    * The meaning of "!important" has been changed. In CSS1, "!important" in
  13654.      an author's style sheet took precedence over one in a user style sheet.
  13655.      This has been reversed in CSS2.
  13656.    * In CSS2 color values are clipped with regard to the device gamut, not
  13657.      with regard to the sRGB gamut as in CSS1.
  13658.    * CSS1 simply said that 'margin-right' was ignored if the both
  13659.      'margin-left' and 'width' were set. In CSS2 the choice between relaxing
  13660.      'margin-right' or 'margin-left' depends on the writing direction.
  13661.    * In CSS1, several properties (e.g., 'padding') had values referring to
  13662.      the width of the parent element. This was an error; the value should
  13663.      always refer to the width of a block-level element and this
  13664.      specification reflects this by introducing the term "containing block".
  13665.    * The initial value of 'display' is 'inline' in CSS2, not 'block' as in
  13666.      CSS1.
  13667.    * In CSS1, the 'clear' property applied to all elements. This was an
  13668.      error, and the property only applies to block-level elements in CSS2.
  13669.    * In CSS1, ':link', ':visited' and ':active' were mutually exclusive; in
  13670.      CSS2, ':active' can occur together with ':link' or ':visited'.
  13671.    * The suggested scaling factor between adjacent 'font-size' indexes in
  13672.      the table of font sizes has been reduced from 1.5 to 1.2.
  13673.    * The computed value, not the actual value, of 'font-size' is inherited.
  13674.    * The CSS1 description of 'inside' (for 'list-style-position') allowed
  13675.      the interpretation that the left margin of the text was affected,
  13676.      rather than the position of the bullet. In CSS2 that interpretation is
  13677.      ruled out.
  13678.    * Please also consult the normative section on the differences between
  13679.      the CSS1 and CSS2 tokenizer.
  13680.  
  13681.   ------------------------------------------------------------------------
  13682.   ------------------------------------------------------------------------
  13683.  
  13684.          Appendix C. Implementation and performance notes for fonts
  13685.  
  13686. Contents
  13687.  
  13688.    * C.1 Glossary of font terms
  13689.    * C.2 Font retrieval
  13690.    * C.3 Meaning of the Panose Digits
  13691.    * C.4 Deducing Unicode Ranges for TrueType
  13692.    * C.5 Automatic descriptor generation
  13693.  
  13694. This appendix is informative, not normative.
  13695.  
  13696. C.1 Glossary of font terms
  13697.  
  13698. DocLock™
  13699.      Bitstream's DocLock™ technology ensures that TrueDoc PFRs can
  13700.      only be used with the site they are published for. A TrueDoc PFR moved
  13701.      to a different site or referenced from another site will not work.
  13702. Digital Signature
  13703.      Part of a trust management technology, used to provide signed
  13704.      assertions about a resource.
  13705. Font Caching
  13706.      Font caching allows for a temporary copy of fonts on the client system.
  13707.      They are often stored on disk with other cached items such as graphics
  13708.      specifically for the UA.
  13709. Font Face
  13710.      A "handle" that refers to a specific face of a font, excluding the font
  13711.      size.
  13712. Font Matching
  13713.      Font matching is a process of selecting a similar font based on using
  13714.      one or more attributes of the primary font. Common attribute include
  13715.      serif, sans-serif, weight, cap height, x-height, spacing, language, and
  13716.      posture. Font matching is dependent on the algorithm and the variety of
  13717.      candidate fonts.
  13718. Glyph Representation Sub-setting
  13719.      Glyph Representation sub-setting is the process by which unwanted glyph
  13720.      representations (together with their side bearings and kerning
  13721.      information) are removed from a primary font to produce a smaller
  13722.      subset font that covers a particular document or set of documents. This
  13723.      is a particular win for documents that use ideographic scripts, where
  13724.      the glyph complement of the base font can be very large. Glyph
  13725.      representation sub-setting for documents using scripts that require
  13726.      ligatures, such as Arabic, is difficult without knowing the ligature
  13727.      formation rules of the final display system.
  13728. Intellifont
  13729.      Intellifont technology was developed by Agfa and is the native format
  13730.      for Hewlett-Packard and other printers that use the PCL5 language. It
  13731.      is also the native font format on the Amiga computers.
  13732. Infinifont
  13733.      A font synthesis technique which, given a Panose-1 number (and,
  13734.      optionally, additional font description data) can generate a faux font
  13735.      without extrapolating from a single master outline or interpolating
  13736.      between two or more outlines (see [INFINIFONT]).
  13737. Italic
  13738.      A class of letter forms for Latin scripts, that are more cursive than
  13739.      roman letter forms but less so than script forms. Often, a pair of
  13740.      fonts are designed to be used together; one is a serifed roman and one
  13741.      is italic. Other terms to describe this class of letter forms include
  13742.      cursive and, for Cyrillic scripts, kursiv. For sans-serif faces, the
  13743.      companion face is often a slanted or oblique variant rather than a
  13744.      different class of letter form.
  13745.  
  13746.      [Italic forms]   [D]
  13747.  
  13748. Kerning
  13749.      Altering the spacing between selected glyph representations, which
  13750.      would otherwise appear to be too close or too far apart, to obtain a
  13751.      more even typographical color.
  13752.  
  13753.      [Illustration of kerning]   [D]
  13754.  
  13755. Multiple Master Font
  13756.      A Multiple Master Font contain two primary fonts that are used with
  13757.      special rendering software to provide an interpolated result. Adobe
  13758.      Systems provides a mechanism that allows for parameters to be used to
  13759.      control the output or the interpolated output font. These parameters
  13760.      generally describe the characteristics of an original font and the
  13761.      multiple master result is referred to as a "synthesized font."
  13762. Open Type
  13763.      Open Type is an extension to the TrueType font format that contains
  13764.      additional information that extends the capabilities of the fonts to
  13765.      support high-quality international typography. Open Type can associate
  13766.      a single character with multiple glyph representations, and
  13767.      combinations of characters with a single glyph representation (ligature
  13768.      formation). Open Type includes two-dimensional information to support
  13769.      features for complex positioning and glyph attachment. TrueType Open
  13770.      and OpenType contain explicit script and language information, so a
  13771.      text-processing application can adjust its behavior accordingly (see
  13772.      [OPENTYPE]).
  13773. Server Font
  13774.      A Server Font is a font resource located on the web server that is
  13775.      referenced by the WebFont definition. The user agent may use this
  13776.      resource for rendering the page.
  13777. Speedo
  13778.      Speedo font technology was developed by Bitstream and is the native
  13779.      font format on the Atari ST and Falcon computers. It is also used by
  13780.      computers running the X window system.
  13781. TrueDoc
  13782.      TrueDoc technology was developed by Bitstream for the creation,
  13783.      transport, and imaging of platform independent scalable font objects on
  13784.      the web. Creation of font objects is done by the TrueDoc character
  13785.      shape recorder (CSR) and the rendering of the font objects is done by
  13786.      TrueDoc's character shape player (CSP). The technology is intended to
  13787.      be used on the web for viewing and printing.
  13788. TrueDoc Portable Font Resource
  13789.      A TrueDoc Portable font resource (or, PFR) is a platform-independent
  13790.      scalable font object that is produced by a character shape player.
  13791.      Input may be either TrueType or Type 1 of any flavor on either Windows,
  13792.      Mac, or Unix. TrueDoc Portable Font Resources provide good compression
  13793.      ratios, are platform independent, and because they are not in an native
  13794.      font format (TrueType or Type 1) they can not be easily installed.
  13795. TrueType
  13796.      TrueType is a font format developed by Apple and licensed to Microsoft.
  13797.      TrueType is the native operating system font format for Windows and
  13798.      Macintosh. TrueType contains a hierarchical set of tables and glyph
  13799.      representations. Characters can be hinted on a per character and point
  13800.      size basis yielding excellent quality at screen resolutions. TrueType
  13801.      fonts for Windows and Mac have few differences, though they can be
  13802.      different enough to prevent cross platform usage.
  13803. TrueType Collection
  13804.      A TrueType Collection (or TTC) is an extension to the TrueType format
  13805.      that includes tables that allow for multiple TrueType fonts to be
  13806.      contained within a single TrueType font file. TrueType collection files
  13807.      are relatively rare at this time.
  13808. TrueType GX Fonts
  13809.      TrueType GX Fonts contain extensions to the standard TrueType format
  13810.      that allow for mutable fonts, similar to Multiple Master fonts. There
  13811.      may be several mutation axis such as weight, height, and slant. The
  13812.      axis can be defined to obtain almost any effect. TrueType GX can also
  13813.      supports alternate glyph representation substitution for ligatures,
  13814.      contextual forms, fractions, etc. To date, TrueType GX is available
  13815.      only on the Mac (see [TRUETYPEGX]).
  13816. Type 1 font
  13817.      Type 1 fonts, developed by Adobe Systems, were one of first scalable
  13818.      formats available. Type 1 fonts generally contain 228 characters with
  13819.      the glyph representations described using third degree bezier curves.
  13820.      Mac, Windows, and X have similar but separate formats; Adobe provides
  13821.      Adobe Type Manager for all three platforms. Type1c is a more recent
  13822.      losslessly-compressed storage form for Type 1 glyph representations.
  13823. URI Binding
  13824.      A process of locking a particular font resource to a given Web site by
  13825.      embedding an encrypted URI or a digitally signed usage assertion into
  13826.      the font resource.
  13827.  
  13828. C.2 Font retrieval
  13829.  
  13830. There are many different font formats in use by many different platforms. To
  13831. select a preferred font format, transparent content negotiation is used (see
  13832. [NEGOT]). It is always possible to tell when a font is being dereferenced,
  13833. because the URI is inside a font description. A given implementation will
  13834. know which downloadable font formats it supports and can thus use the format
  13835. hint to avoid downloading fonts in an unsupported format.
  13836.  
  13837. C.3 Meaning of the Panose Digits
  13838.  
  13839. [Illustration of Panose-1]   [D]
  13840.  
  13841. The Family, Serif Style and Proportion numbers are used by Windows95 for
  13842. font selection and matching.
  13843.  
  13844. The meaning of the ten numbers and the allowable values (given in
  13845. parentheses) are given below for the most common case, where the "family"
  13846. digit is 2, Text and Display. (If the first digit has a different value, the
  13847. remaining nine digits have different meanings). For further details on
  13848. Panose-1, see [PANOSE].
  13849.  
  13850. Family
  13851.         o Any (0)
  13852.         o No Fit (1)
  13853.         o [PANOSE] Latin Text and Display (2)
  13854.         o [PANOSE] Latin Script (3)
  13855.         o [PANOSE] Latin Decorative (4)
  13856.         o [PANOSE] Latin Pictorial (5)
  13857. Serif Style
  13858.         o Any (0)
  13859.         o No Fit (1)
  13860.         o Cove (2)
  13861.         o Obtuse Cove (3)
  13862.         o Square Cove (4)
  13863.         o Obtuse Square Cove (5)
  13864.         o Square (6)
  13865.         o Thin (7)
  13866.         o Bone (8)
  13867.         o Exaggerated (9)
  13868.         o Triangle (10)
  13869.         o Normal Sans (11)
  13870.         o Obtuse Sans (12)
  13871.         o Perp Sans (13)
  13872.         o Flared (14)
  13873.         o Rounded (15)
  13874. Weight
  13875.         o Any (0)
  13876.         o No Fit (1)
  13877.         o Very Light (2)[100]
  13878.         o Light (3) [200]
  13879.         o Thin (4) [300]
  13880.         o Book (5) [400] same as CSS1 'normal'
  13881.         o Medium (6) [500]
  13882.         o Demi (7) [600]
  13883.         o Bold (8) [700] same as CSS1 'bold'
  13884.         o Heavy (9) [800]
  13885.         o Black (10) [900]
  13886.         o Extra Black / Nord (11) [900] force mapping to CSS1 100-900 scale
  13887. Proportion
  13888.         o Any (0)
  13889.         o No Fit (1)
  13890.         o Old Style (2)
  13891.         o Modern (3)
  13892.         o Even Width (4)
  13893.         o Expanded (5)
  13894.         o Condensed (6)
  13895.         o Very Expanded (7)
  13896.         o Very Condensed (8)
  13897.         o Monospaced (9)
  13898. Contrast
  13899.         o Any (0)
  13900.         o No Fit (1)
  13901.         o None (2)
  13902.         o Very Low (3)
  13903.         o Low (4)
  13904.         o Medium Low (5)
  13905.         o Medium (6)
  13906.         o Medium High (7)
  13907.         o High (8)
  13908.         o Very High (9)
  13909. Stroke Variation
  13910.         o Any (0)
  13911.         o No Fit (1)
  13912.         o No Variation (2)
  13913.         o Gradual/Diagonal (3)
  13914.         o Gradual/Transitional (4)
  13915.         o Gradual/Vertical (5)
  13916.         o Gradual/Horizontal (6)
  13917.         o Rapid/Vertical (7)
  13918.         o Rapid/Horizontal (8)
  13919.         o Instant/Horizontal (9)
  13920.         o Instant/Vertical (10)
  13921. Arm Style
  13922.         o Any (0)
  13923.         o No Fit (1)
  13924.         o Straight Arms/Horizontal (2)
  13925.         o Straight Arms/Wedge (3)
  13926.         o Straight Arms/Vertical (4)
  13927.         o Straight Arms/Single Serif (5)
  13928.         o Straight Arms/Double Serif (6)
  13929.         o Non-Straight Arms/Horizontal (7)
  13930.         o Non-Straight Arms/Wedge (8)
  13931.         o Non-Straight Arms/Vertical 90)
  13932.         o Non-Straight Arms/Single Serif (10)
  13933.         o Non-Straight Arms/Double Serif (11)
  13934. Letterform
  13935.         o Any (0)
  13936.         o No Fit (1)
  13937.         o Normal/Contact (2)
  13938.         o Normal/Weighted (3)
  13939.         o Normal/Boxed (4)
  13940.         o Normal/Flattened (5)
  13941.         o Normal/Rounded (6)
  13942.         o Normal/Off Center (7)
  13943.         o Normal/Square (8)
  13944.         o Oblique/Contact (9)
  13945.         o Oblique/Weighted (10)
  13946.         o Oblique/Boxed (11)
  13947.         o Oblique/Flattened (12)
  13948.         o Oblique/Rounded (13)
  13949.         o Oblique/Off Center (14)
  13950.         o Oblique/Square (15)
  13951. Midline
  13952.         o Any (0)
  13953.         o No Fit (1)
  13954.         o Standard/Trimmed (2)
  13955.         o Standard/Pointed (3)
  13956.         o Standard/Serifed (4)
  13957.         o High/Trimmed (5)
  13958.         o High/Pointed (6)
  13959.         o High/Serifed (7)
  13960.         o Constant/Trimmed (8)
  13961.         o Constant/Pointed (9)
  13962.         o Constant/Serifed (10)
  13963.         o Low/Trimmed (11)
  13964.         o Low/Pointed (12)
  13965.         o Low/Serifed (13)
  13966. XHeight
  13967.         o Any (0)
  13968.         o No Fit (1)
  13969.         o Constant/Small (2)
  13970.         o Constant/Standard (3)
  13971.         o Constant/Large (4)
  13972.         o Ducking/Small (5)
  13973.         o Ducking/Standard (6)
  13974.         o Ducking/Large (7)
  13975.  
  13976. Panose-2 (see [PANOSE2]) is a specification for a more comprehensive font
  13977. classification and matching technology which is not limited to Latin
  13978. typefaces. For example, the serif characteristics of a Latin face may be
  13979. compared with the stroke terminations of a Kanji face.
  13980.  
  13981. [Illustration of Panose-2]
  13982.  
  13983. The Panose-2 value is not stored inside any known font formats, but may be
  13984. measured.
  13985.  
  13986. C.4 Deducing Unicode Ranges for TrueType
  13987.  
  13988. This information is available in the font by looking at the 'ulUnicodeRange'
  13989. bits in the 'OS/2' table (if it has one), which holds a bitfield
  13990. representation of the set. This table is defined in revision 1.66 of the
  13991. TrueType specification, from Microsoft. Considering this information as a
  13992. set, each element corresponds to a Unicode 1.1 character block, and the
  13993. presence of that element in the set indicates that the font has one or more
  13994. glyph representations to represent at least one character in that block. The
  13995. set has 128 elements as described below. The order generally follows that in
  13996. the Unicode 1.1 standard. This table may be used to convert the information
  13997. in a TrueType font into a CSS 'unicode-range' descriptor.
  13998.  ------------------------------------------------------------
  13999.  BlockAdd            Block name             Unicode range
  14000.  ------------------------------------------------------------
  14001.  0    1   Basic Latin                     U+0-7F
  14002.  1    2   Latin-1 Supplement              U+80-FF
  14003.  2    4   Latin-1 Extended-A              U+100-17F
  14004.  3    8   Latin Extended-B                U+180-24F
  14005.  ------------------------------------------------------------
  14006.  4    1   IPA Extensions                  U+250-2AF
  14007.  5    2   Spacing Modifier Letters        U+2B0-2FF
  14008.  6    4   Combining Diacritical Marks     U+300-36F
  14009.  7    8   Greek                           U+370-3CF
  14010.  ------------------------------------------------------------
  14011.  8    1   Greek Symbols and Coptic        U+3D0-3EF
  14012.  9    2   Cyrillic                        U+400-4FF
  14013.  10   4   Armenian                        U+530-58F
  14014.  11   8   Hebrew                          U+590-5FF
  14015.  ------------------------------------------------------------
  14016.  
  14017.  12   1   Hebrew Extended-A               ?? what ranges ??
  14018.           Hebrew Extended-B
  14019.  13   2   Arabic                          U+600-69F
  14020.  14   4   Arabic Extended                 U+670-6FF
  14021.  15   8   Devanagari                      U+900-97F
  14022.  ------------------------------------------------------------
  14023.  16   1   Bengali                         U+980-9FF
  14024.  17   2   Gurmukhi                        U+A00-A7F
  14025.  18   4   Gujarati                        U+A80-AFF
  14026.  19   8   Oriya                           U+B00-B7F
  14027.  ------------------------------------------------------------
  14028.  20   1   Tamil                           U+B80-BFF
  14029.  21   2   Telugu                          U+C00-C7F
  14030.  22   4   Kannada                         U+C80-CFF
  14031.  23   8   Malayalam                       U+D00-D7F
  14032.  ------------------------------------------------------------
  14033.  24   1   Thai                            U+E00-E7F
  14034.  25   2   Lao                             U+E80-EFF
  14035.  26   4   Georgian                        U+10A0-10EF
  14036.  27   8   Georgian Extended               U+10F0-10FF ??
  14037.  ------------------------------------------------------------
  14038.  28   1   Hangul Jamo                     U+1100-11FF
  14039.  29   2   Latin Extended Additional       -
  14040.  30   4   Greek Extended                  U+1F00-1FFF
  14041.  31   8   General Punctuation             U+2000-206F
  14042.  ------------------------------------------------------------
  14043.  32   1   Superscripts and Subscripts     -
  14044.  33   2   Currency Symbols                U+20A0-20CF
  14045.  34   4   Combining Marks for Symbols     U+20D0-20FF
  14046.  35   8   Letterlike Symbols              U+2100-214F
  14047.  ------------------------------------------------------------
  14048.  36   1   Number Forms                    U+2150-218F
  14049.  37   2   Arrows                          U+2190-21FF
  14050.  38   4   Mathematical Operators          U+2200-22FF
  14051.  39   8   Miscellaneous Technical         U+2300-23FF
  14052.  ------------------------------------------------------------
  14053.  40   1   Control Pictures                U+2400-243F
  14054.  41   2   Optical Character Recognition   U+2440-245F
  14055.  42   4   Enclosed Alphanumerics          U+2460-24FF
  14056.  43   8   Box Drawing                     U+2500-257F
  14057.  ------------------------------------------------------------
  14058.  44   1   Block Elements                  U+2580-259F
  14059.  45   2   Geometric Shapes                U+25A0-25FF
  14060.  46   4   Miscellaneous Symbols           U+2600-26FF
  14061.  47   8   Dingbats                        U+2700-27BF
  14062.  ------------------------------------------------------------
  14063.  48   1   CJK Symbols and Punctuation     U+3000-303F
  14064.  49   2   Hiragana                        U+3040-309F
  14065.  50   4   Katakana                        U+30A0-30FF
  14066.  51   8   Bopomofo                        U+3100-312F
  14067.  ------------------------------------------------------------
  14068.  52   1   Hangul Compatibility Jamo       U+3130-318F
  14069.  53   2   CJK Miscellaneous               ??
  14070.  54   4   Enclosed CJK Letters and Months U+3200-32FF
  14071.  55   8   CJK compatibility               U+3300-33FF
  14072.  ------------------------------------------------------------
  14073.  56   1   Hangul                          U+AC00-D7FF
  14074.  59   8   CJK Unified Ideographs          U+4E00-9FFF
  14075.  ------------------------------------------------------------
  14076.  60   1   Private Use Area                U+E000-F8FF
  14077.  61   2   CJK Compatibility Ideographs    U+F900-FAFF
  14078.  62   4   Alphabetic Presentation Forms   U+FB00-FB4F
  14079.  63   8   Arabic Presentation Forms-A     U+FB50-FDFF
  14080.  ------------------------------------------------------------
  14081.  64   1   Combining Half Marks            U+FE20-FE2F
  14082.  65   2   CJK compatibility Forms         U+FE30-FE4F
  14083.  66   4   Small Form Variants             U+FE50-FE6F
  14084.  67   8   Arabic Presentation Forms-B     U+FE70-FEFF
  14085.  ------------------------------------------------------------
  14086.  68   1   Halfwidth and Fullwidth Forms   U+FF00-FFEF
  14087.  69   2   Specials                        U+FFF0-FFFD
  14088.  
  14089. The TrueType bitfield system has the problem that it is tied to Unicode 1.1
  14090. and is unable to cope with Unicode expansion - it is unable to represent
  14091. Tibetan for example, or other scripts introduced with Unicode 2.0 or later
  14092. revisions.
  14093.  
  14094. C.5 Automatic descriptor generation
  14095.  
  14096. Authoring tools should allow style sheet authors to add and edit font
  14097. descriptors. In some cases, however, authoring tools can help by examining
  14098. locally installed fonts and automatically generating descriptors for fonts
  14099. referenced in the style sheet. This is also a function that can be carried
  14100. out by tools which subset or convert fonts ready for dynamic download.
  14101.  
  14102. This table suggests where such information can be found, for common font
  14103. formats.
  14104.  
  14105.  Descriptor      Type 1         TrueType and OpenType  TrueType GX
  14106.                                                        [TRUETYPEGX]
  14107.                                 'Ascender' in 'hhea'
  14108.  'ascent'        'Ascender' in  table or (preferably)  'horizontalBefore'
  14109.                  AFM/PFM file   'sTypoAscender' in     in 'fmtx' table
  14110.                                 'OS/2' table
  14111.  'baseline'                                            bsln table, see note
  14112.                                 'xMin', 'xMax',
  14113.  'bbox'          FontBBox, font 'yMin' and 'yMax'
  14114.                  dictionary     entries of the 'head'
  14115.                                 table
  14116.  
  14117.  'cap-height'    CapHeight in
  14118.                  AFM/PFM file
  14119.                  'Descender' in
  14120.  'descent'       the AFM/PFM
  14121.                  file.
  14122.  'mathline'                                            bsln table
  14123.                  FamilyName,
  14124.  'font-family'   fontinfo       name table
  14125.                  dictionary
  14126.                  StdHW, private
  14127.  'stemh'         dictionary of
  14128.                  AFM/PFM file
  14129.                  /StdVW,
  14130.  'stemv'         private        cvt table
  14131.                  dictionary
  14132.  'topline'                                             bsln table
  14133.  
  14134.  'unicode-range' cmap file      OS/2 table, see
  14135.                                 Appendix C
  14136.                  FontMatrix,
  14137.  'units-per-em'  font           unitsPerEm, head
  14138.                  dictionary     table.
  14139.  'widths'                       hmtx table
  14140.  
  14141.    * Within the bsln table, the ideographic centered baseline may be used
  14142.      for stretches of predominantly ideographic characters and the
  14143.      ideographic low baseline is more suitable for ideographic characters in
  14144.      a run of predominantly Latin, Greek or Cyrillic characters.
  14145.  
  14146.   ------------------------------------------------------------------------
  14147.   ------------------------------------------------------------------------
  14148.  
  14149.                        Appendix D. The grammar of CSS2
  14150.  
  14151. Contents
  14152.  
  14153.    * D.1 Grammar
  14154.    * D.2 Lexical scanner
  14155.    * D.3 Comparison of tokenization in CSS2 and CSS1
  14156.  
  14157. This appendix is normative.
  14158.  
  14159. The grammar below defines the syntax of CSS2. It is in some sense, however,
  14160. a superset of CSS2 as this specification imposes additional semantic
  14161. constraints not expressed in this grammar. A conforming UA must also adhere
  14162. to the forward-compatible parsing rules, the property and value notation,
  14163. and the unit notation. In addition, the document language may impose
  14164. restrictions, e.g. HTML imposes restrictions on the possible values of the
  14165. "class" attribute.
  14166.  
  14167. D.1 Grammar
  14168.  
  14169. The grammar below is LL(1) (but note that most UA's should not use it
  14170. directly, since it doesn't express the parsing conventions, only the CSS2
  14171. syntax). The format of the productions is optimized for human consumption
  14172. and some shorthand notation beyond Yacc (see [YACC]) is used:
  14173.  
  14174.    * *: 0 or more
  14175.    * +: 1 or more
  14176.    * ?: 0 or 1
  14177.    * |: separates alternatives
  14178.    * [ ]: grouping
  14179.  
  14180. The productions are:
  14181.  
  14182. stylesheet
  14183.   : [ CHARSET_SYM S* STRING S* ';' ]?
  14184.     [S|CDO|CDC]* [ import [S|CDO|CDC]* ]*
  14185.     [ [ ruleset | media | page | font_face ] [S|CDO|CDC]* ]*
  14186.   ;
  14187. import
  14188.   : IMPORT_SYM S*
  14189.     [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
  14190.   ;
  14191. media
  14192.   : MEDIA_SYM S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
  14193.   ;
  14194. medium
  14195.   : IDENT S*
  14196.   ;
  14197. page
  14198.   : PAGE_SYM S* IDENT? pseudo_page? S*
  14199.     '{' S* declaration [ ';' S* declaration ]* '}' S*
  14200.   ;
  14201. pseudo_page
  14202.   : ':' IDENT
  14203.   ;
  14204. font_face
  14205.   : FONT_FACE_SYM S*
  14206.     '{' S* declaration [ ';' S* declaration ]* '}' S*
  14207.   ;
  14208. operator
  14209.   : '/' S* | ',' S* | /* empty */
  14210.   ;
  14211. combinator
  14212.   : '+' S* | '>' S* | /* empty */
  14213.   ;
  14214. unary_operator
  14215.   : '-' | '+'
  14216.   ;
  14217. property
  14218.   : IDENT S*
  14219.   ;
  14220. ruleset
  14221.   : selector [ ',' S* selector ]*
  14222.     '{' S* declaration [ ';' S* declaration ]* '}' S*
  14223.   ;
  14224. selector
  14225.   : simple_selector [ combinator simple_selector ]*
  14226.   ;
  14227. simple_selector
  14228.   : element_name? [ HASH | class | attrib | pseudo ]* S*
  14229.   ;
  14230. class
  14231.   : '.' IDENT
  14232.   ;
  14233. element_name
  14234.   : IDENT | '*'
  14235.   ;
  14236. attrib
  14237.   : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S*
  14238.     [ IDENT | STRING ] S* ]? ']'
  14239.   ;
  14240. pseudo
  14241.   : ':' [ IDENT | FUNCTION S* IDENT S* ')' ]
  14242.   ;
  14243. declaration
  14244.   : property ':' S* expr prio?
  14245.   | /* empty */
  14246.   ;
  14247. prio
  14248.   : IMPORTANT_SYM S*
  14249.   ;
  14250. expr
  14251.   : term [ operator term ]*
  14252.   ;
  14253. term
  14254.   : unary_operator?
  14255.     [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* |
  14256.       TIME S* | FREQ S* | function ]
  14257.   | STRING S* | IDENT S* | URI S* | RGB S* | UNICODERANGE S* | hexcolor
  14258.   ;
  14259. function
  14260.   : FUNCTION S* expr ')' S*
  14261.   ;
  14262. /*
  14263.  * There is a constraint on the color that it must
  14264.  * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])
  14265.  * after the "#"; e.g., "#000" is OK, but "#abcd" is not.
  14266.  */
  14267. hexcolor
  14268.   : HASH S*
  14269.   ;
  14270.  
  14271. D.2 Lexical scanner
  14272.  
  14273. The following is the tokenizer, written in Flex (see [FLEX]) notation. The
  14274. tokenizer is case-insensitive.
  14275.  
  14276. The two occurrences of "\377" represent the highest character number that
  14277. current versions of Flex can deal with (decimal 255). They should be read as
  14278. "\4177777" (decimal 1114111), which is the highest possible code point in
  14279. Unicode/ISO-10646.
  14280.  
  14281. %option case-insensitive
  14282.  
  14283. h               [0-9a-f]
  14284. nonascii        [\200-\377]
  14285. unicode         \\{h}{1,6}[ \t\r\n\f]?
  14286. escape          {unicode}|\\[ -~\200-\377]
  14287. nmstart         [a-z]|{nonascii}|{escape}
  14288. nmchar          [a-z0-9-]|{nonascii}|{escape}
  14289. string1         \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
  14290. string2         \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'
  14291.  
  14292. ident           {nmstart}{nmchar}*
  14293. name            {nmchar}+
  14294. num             [0-9]+|[0-9]*"."[0-9]+
  14295. string          {string1}|{string2}
  14296. url             ([!#$%&*-~]|{nonascii}|{escape})*
  14297. w               [ \t\r\n\f]*
  14298. nl              \n|\r\n|\r|\f
  14299. range           \?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h})))))
  14300.  
  14301. %%
  14302.  
  14303. [ \t\r\n\f]+            {return S;}
  14304.  
  14305. \/\*[^*]*\*+([^/][^*]*\*+)*\/   /* ignore comments */
  14306.  
  14307. "<!--"                  {return CDO;}
  14308. "-->"                   {return CDC;}
  14309. "~="                    {return INCLUDES;}
  14310. "|="                    {return DASHMATCH;}
  14311.  
  14312. {string}                {return STRING;}
  14313.  
  14314. {ident}                 {return IDENT;}
  14315.  
  14316. "#"{name}               {return HASH;}
  14317.  
  14318. "@import"               {return IMPORT_SYM;}
  14319. "@page"                 {return PAGE_SYM;}
  14320. "@media"                {return MEDIA_SYM;}
  14321. "@font-face"            {return FONT_FACE_SYM;}
  14322. "@charset"              {return CHARSET_SYM;}
  14323. "@"{ident}              {return ATKEYWORD;}
  14324.  
  14325. "!{w}important"         {return IMPORTANT_SYM;}
  14326.  
  14327. {num}em                 {return EMS;}
  14328. {num}ex                 {return EXS;}
  14329. {num}px                 {return LENGTH;}
  14330. {num}cm                 {return LENGTH;}
  14331. {num}mm                 {return LENGTH;}
  14332. {num}in                 {return LENGTH;}
  14333. {num}pt                 {return LENGTH;}
  14334. {num}pc                 {return LENGTH;}
  14335. {num}deg                {return ANGLE;}
  14336. {num}rad                {return ANGLE;}
  14337. {num}grad               {return ANGLE;}
  14338. {num}ms                 {return TIME;}
  14339. {num}s                  {return TIME;}
  14340. {num}Hz                 {return FREQ;}
  14341. {num}kHz                {return FREQ;}
  14342. {num}{ident}            {return DIMEN;}
  14343. {num}%                  {return PERCENTAGE;}
  14344. {num}                   {return NUMBER;}
  14345.  
  14346. "url("{w}{string}{w}")" {return URI;}
  14347. "url("{w}{url}{w}")"    {return URI;}
  14348. {ident}"("              {return FUNCTION;}
  14349.  
  14350. U\+{range}              {return UNICODERANGE;}
  14351. U\+{h}{1,6}-{h}{1,6}    {return UNICODERANGE;}
  14352.  
  14353. .                       {return *yytext;}
  14354.  
  14355. D.3 Comparison of tokenization in CSS2 and CSS1
  14356.  
  14357. There are some differences in the syntax specified in the CSS1
  14358. recommendation ([CSS1]), and the one above. Most of these are due to new
  14359. tokens in CSS2 that didn't exist in CSS1. Others are because the grammar has
  14360. been rewritten to be more readable. However, there are some incompatible
  14361. changes, that were felt to be errors in the CSS1 syntax. They are explained
  14362. below.
  14363.  
  14364.    * CSS1 style sheets could only be in 1-byte-per-character encodings, such
  14365.      as ASCII and ISO-8859-1. CSS2 has no such limitation. In practice,
  14366.      there was little difficulty in extrapolating the CSS1 tokenizer, and
  14367.      some UAs have accepted 2-byte encodings.
  14368.    * CSS1 only allowed four hex-digits after the backslash (\) to refer to
  14369.      Unicode characters, CSS2 allows six. Furthermore, CSS2 allows a
  14370.      whitespace character to delimit the escape sequence. E.g., according to
  14371.      CSS1, the string "\abcdef" has 3 letters (\abcd, e, and f), according
  14372.      to CSS2 it has only one (\abcdef).
  14373.    * The tab character (ASCII 9) was not allowed in strings. However, since
  14374.      strings in CSS1 were only used for font names and for URLs, the only
  14375.      way this can lead to incompatibility between CSS1 and CSS2 is if a
  14376.      style sheet contains a font family that has a tab in its name.
  14377.    * Similarly, newlines (escaped with a backslash) were not allowed in
  14378.      strings in CSS1.
  14379.    * CSS2 parses a number immediately followed by an identifier as a DIMEN
  14380.      token (i.e., an unknown unit), CSS1 parsed it as a number and an
  14381.      identifier. That means that in CSS1, the declaration 'font:
  14382.      10pt/1.2serif' was correct, as was 'font: 10pt/12pt serif'; in CSS2, a
  14383.      space is required before "serif". (Some UAs accepted the first example,
  14384.      but not the second.)
  14385.    * In CSS1, a class name could start with a digit (".55ft"), unless it was
  14386.      a dimension (".55in"). In CSS2, such classes are parsed as unknown
  14387.      dimensions (to allow for future additions of new units). To make
  14388.      ".55ft" a valid class, CSS2 requires the first digit to be escaped
  14389.      (".\55ft")
  14390.  
  14391.   ------------------------------------------------------------------------
  14392.   ------------------------------------------------------------------------
  14393.  
  14394.                            Appendix E. References
  14395.  
  14396. Contents
  14397.  
  14398.    * E.1 Normative references
  14399.    * E.2 Informative references
  14400.  
  14401. E.1 Normative references
  14402.  
  14403. [COLORIMETRY]
  14404.      "Colorimetry, Second Edition", CIE Publication 15.2-1986, ISBN
  14405.      3-900-734-00-3.
  14406.      Available at
  14407.      http://www.hike.te.chiba-u.ac.jp/ikeda/CIE/publ/abst/15-2-86.html.
  14408. [CSS1]
  14409.      "Cascading Style Sheets, level 1", H. W. Lie and B. Bos, 17 December
  14410.      1996.
  14411.      Available at http://www.w3.org/TR/REC-CSS1-961217.html.
  14412. [FLEX]
  14413.      "Flex: The Lexical Scanner Generator", Version 2.3.7, ISBN 1882114213.
  14414. [HTML40]
  14415.      "HTML 4.0 Specification", D. Raggett, A. Le Hors, I. Jacobs, 8 July
  14416.      1997.
  14417.      Available at http://www.w3.org/TR/REC-html40/. The Recommendation
  14418.      defines three document type definitions: Strict, Transitional, and
  14419.      Frameset, all reachable from the Recommendation.
  14420. [IANA]
  14421.      "Assigned Numbers", STD 2, RFC 1700, USC/ISI, J. Reynolds and J.
  14422.      Postel, October 1994.
  14423.      Available at ftp://ftp.internic.net/rfc/rfc1700.txt.
  14424. [ICC32]
  14425.      "ICC Profile Format Specification, version 3.2", 1995.
  14426.      Available at ftp://sgigate.sgi.com/pub/icc/ICC32.pdf.
  14427. [ISO8879]
  14428.      ISO 8879:1986 "Information Processing -- Text and Office Systems --
  14429.      Standard Generalized Markup Language (SGML)", ISO 8879:1986.
  14430.      For the list of SGML entities, consult
  14431.      ftp://ftp.ifi.uio.no/pub/SGML/ENTITIES/.
  14432. [ISO10646]
  14433.      "Information Technology - Universal Multiple- Octet Coded Character Set
  14434.      (UCS) - Part 1: Architecture and Basic Multilingual Plane", ISO/IEC
  14435.      10646-1:1993. The current specification also takes into consideration
  14436.      the first five amendments to ISO/IEC 10646-1:1993. Useful roadmap of
  14437.      the BMP and roadmap of plane 1 documents show which scripts sit at
  14438.      which numeric ranges.
  14439. [PNG10]
  14440.      "PNG (Portable Network Graphics) Specification, Version 1.0
  14441.      specification", T. Boutell ed., 1 October 1996.
  14442.      Available at http://www.w3.org/pub/WWW/TR/REC-png-multi.html.
  14443. [RFC1808]
  14444.      "Relative Uniform Resource Locators", R. Fielding, June 1995.
  14445.      Available at ftp://ds.internic.net/rfc/rfc1808.txt.
  14446. [RFC2045]
  14447.      "Multipurpose Internet Mail Extensions (MIME) Part One: Format of
  14448.      Internet Message Bodies", N. Freed and N. Borenstein, November 1996.
  14449.      Available at ftp://ftp.internic.net/rfc/rfc2045.txt. Note that this RFC
  14450.      obsoletes RFC1521, RFC1522, and RFC1590.
  14451. [RFC2068]
  14452.      "HTTP Version 1.1 ", R. Fielding, J. Gettys, J. Mogul, H. Frystyk
  14453.      Nielsen, and T. Berners-Lee, January 1997.
  14454.      Available at ftp://ftp.internic.net/rfc/rfc2068.txt.
  14455. [RFC2070]
  14456.      "Internationalization of the HyperText Markup Language", F. Yergeau, G.
  14457.      Nicol, G. Adams, and M. D¸rst, January 1997.
  14458.      Available at ftp://ds.internic.net/rfc/rfc2070.txt.
  14459. [RFC2119]
  14460.      "Key words for use in RFCs to Indicate Requirement Levels", S. Bradner,
  14461.      March 1997.
  14462.      Available at ftp://ds.internic.net/rfc/rfc2119.txt.
  14463. [RFC2318]
  14464.      "The text/css Media Type", H. Lie, B. Bos, C. Lilley, March 1998.
  14465.      Available at ftp://ds.internic.net/rfc/rfc2318.txt.
  14466. [RFC1738]
  14467.      "Uniform Resource Locators", T. Berners-Lee, L. Masinter, and M.
  14468.      McCahill, December 1994.
  14469.      Available at ftp://ds.internic.net/rfc/rfc1738.txt.
  14470. [SRGB]
  14471.      "Proposal for a Standard Color Space for the Internet - sRGB", M.
  14472.      Anderson, R. Motta, S. Chandrasekar, M. Stokes.
  14473.      Available at http://www.w3.org/Graphics/Color/sRGB.html.
  14474. [UNICODE]
  14475.      "The Unicode Standard: Version 2.0", The Unicode Consortium,
  14476.      Addison-Wesley Developers Press, 1996. For bidirectionality, see also
  14477.      the corrigenda at http://www.unicode.org/unicode/uni2errata/bidi.htm.
  14478.      For more information, consult the Unicode Consortium's home page at
  14479.      http://www.unicode.org/.
  14480.      The latest version of Unicode. For more information, consult the
  14481.      Unicode Consortium's home page at http://www.unicode.org/.
  14482. [URI]
  14483.      "Uniform Resource Identifiers (URI): Generic Syntax and Semantics", T.
  14484.      Berners-Lee, R. Fielding, L. Masinter, 18 November 1997.
  14485.      Available at
  14486.      http://www.ics.uci.edu/pub/ietf/uri/draft-fielding-uri-syntax-01.txt.
  14487.      This is a work in progress that is expected to update [RFC1738] and
  14488.      [RFC1808].
  14489. [XML10]
  14490.      "Extensible Markup Language (XML) 1.0" T. Bray, J. Paoli, C.M.
  14491.      Sperberg-McQueen, editors, 10 February 1998.
  14492.      Available at http://www.w3.org/TR/REC-xml/.
  14493. [YACC]
  14494.      "YACC - Yet another compiler compiler", S. C. Johnson, Technical
  14495.      Report, Murray Hill, 1975.
  14496.  
  14497. E.2 Informative references
  14498.  
  14499. [CHARSETS]
  14500.      Registered charset values. Download a list of registered charset values
  14501.      from ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets.
  14502. [DOM]
  14503.      "Document Object Model Specification", L. Wood, A. Le Hors, 9 October
  14504.      1997.
  14505.      Available at http://www.w3.org/TR/WD-DOM/
  14506. [ISO10179]
  14507.      ISO/IEC 10179:1996 "Information technology -- Processing languages --
  14508.      Document Style Semantics and Specification Language (DSSSL)"
  14509.      Available at http://occam.sjf.novell.com:8080/dsssl/dsssl96.
  14510. [GAMMA]
  14511.      "Gamma correction on the Macintosh Platform", C. A. Poynton.
  14512.      Available at
  14513.      ftp://ftp.inforamp.net/pub/users/poynton/doc/Mac/Mac_gamma.pdf.
  14514. [HTML32]
  14515.      "HTML 3.2 Reference Specification", Dave Raggett, 14 January 1997.
  14516.      Available at http://www.w3.org/TR/REC-html32.html.
  14517. [INFINIFONT]
  14518.      See http://www.fonts.com/hp/infinifont/moredet.html.
  14519. [ISO9899]
  14520.      ISO/IEC 9899:1990 Programming languages -- C.
  14521. [MONOTYPE]
  14522.      See http://www.monotype.com/html/oem/uni_scrmod.html.
  14523. [NEGOT]
  14524.      "Transparent Content Negotiation in HTTP", K. Holtman, A. Mutz, 9
  14525.      March, 1997.
  14526.      Available at
  14527.      http://gewis.win.tue.nl/~koen/conneg/draft-ietf-http-negotiation-01.html.
  14528. [OPENTYPE]
  14529.      See http://www.microsoft.com/OpenType/OTSpec/tablist.htm.
  14530. [PANOSE]
  14531.      For information about PANOSE classification metrics, consult
  14532.      http://www.fonts.com/hp/panose/greybook and the following chapters:
  14533.      Latin Text, Latin Script, Latin Decorative, and Latin Pictorial.
  14534.  
  14535.      Panose numbers for some fonts are available online and may be queried.
  14536. [PANOSE2]
  14537.      See http://www.w3.org/Fonts/Panose/pan2.html Panose-2 is not limited to
  14538.      Latin typefaces.
  14539. [POSTSCRIPT]
  14540.      "The PostScript Language Reference Manual", Second Edition, Adobe
  14541.      Systems, Inc., Addision-Wesley Publishing Co., December 1990.
  14542. [RFC1630]
  14543.      "Universal Resource Identifiers in WWW: A Unifying Syntax for the
  14544.      Expression of Names and Addresses of Objects on the Network as used in
  14545.      the World-Wide Web", T. Berners-Lee, June 1994.
  14546.      Available at ftp://ftp.internic.net/rfc/rfc1630.txt.
  14547. [RFC1766]
  14548.      "Tags for the Identification of Languages", H. Alvestrand, March 1995.
  14549.      Available at ftp://ftp.internic.net/rfc/rfc1766.txt.
  14550. [RFC1866]
  14551.      "HyperText Markup Language 2.0", T. Berners-Lee and D. Connolly,
  14552.      November 1995.
  14553.      Available at ftp://ds.internic.net/rfc/rfc1866.txt.
  14554. [RFC1942]
  14555.      "HTML Tables", Dave Raggett, May 1996.
  14556.      Available at ftp://ds.internic.net/rfc/rfc1942.txt.
  14557. [TRUETYPEGX]
  14558.      See http://fonts.apple.com/TTRefMan/index.html for details about
  14559.      TrueType GX from Apple Computer, including descriptions of the added
  14560.      tables and font quality specifications.
  14561. [W3CSTYLE]
  14562.      W3C resource page on web style sheets.
  14563.      Examine at http://www.w3.org/pub/WWW/Style.
  14564. [WAI-PAGEAUTH]
  14565.      "WAI Accesibility Guidelines: Page Authoring" for designing accessible
  14566.      documents are available at:
  14567.      http://www.w3.org/TR/WD-WAI-PAGEAUTH.
  14568.  
  14569.   ------------------------------------------------------------------------
  14570.   ------------------------------------------------------------------------
  14571.  
  14572.                          Appendix F. Property index
  14573.  
  14574.           Name                   Values           Initial     Applies to     Inherited?     Percentages       Media groups
  14575.                                                    value     (Default: all)                (Default: N/A)
  14576.                         <angle> | [[ left-side
  14577.                         | far-left | left |
  14578.                         center-left | center |
  14579.  'azimuth'              center-right | right |  center                       yes                              aural
  14580.                         far-right | right-side
  14581.                         ] || behind ] |
  14582.                         leftwards | rightwards
  14583.                         | inherit
  14584.                         ['background-color' ||
  14585.                         'background-image' ||
  14586.                         'background-repeat' ||
  14587.  'background'           'background-attachment' XX                           no        allowed on             visual
  14588.                         ||                                                             'background-position'
  14589.                         'background-position']
  14590.                         | inherit
  14591.  
  14592.  'background-attachment'scroll | fixed |        scroll                       no                               visual
  14593.                         inherit
  14594.  
  14595.  'background-color'     <color> | transparent | transparent                  no                               visual
  14596.                         inherit
  14597.  'background-image'     <uri> | none | inherit  none                         no                               visual
  14598.                         [ [<percentage> |
  14599.                         <length> ]{1,2} | [                 block-level and
  14600.  'background-position'  [top | center | bottom] 0% 0%       replaced         no        refer to the size of   visual
  14601.                         || [left | center |                 elements                   the box itself
  14602.                         right] ] ] | inherit
  14603.                         repeat | repeat-x |
  14604.  'background-repeat'    repeat-y | no-repeat |  repeat                       no                               visual
  14605.                         inherit
  14606.                         [ 'border-width' ||     see
  14607.  'border'               'border-style' ||       individual                   no                               visual
  14608.                         <color> ] | inherit     properties
  14609.                                                             'table' and
  14610.  'border-collapse'      collapse | separate |   collapse    'inline-table'   yes                              visual
  14611.                         inherit
  14612.                                                             elements
  14613.                                                 see
  14614.  'border-color'         <color>{1,4} |          individual                   no                               visual
  14615.                         transparent | inherit
  14616.                                                 properties
  14617.                                                             'table' and
  14618.  'border-spacing'       <length> <length>? |    0           'inline-table'   yes                              visual
  14619.                         inherit
  14620.                                                             elements
  14621.                                                 see
  14622.  'border-style'         <border-style>{1,4} |   individual                   no                               visual
  14623.                         inherit
  14624.                                                 properties
  14625.  'border-top'
  14626.  'border-right'         [ 'border-top-width' || see
  14627.  'border-bottom'        'border-style' ||       individual                   no                               visual
  14628.  'border-left'          <color> ] | inherit     properties
  14629.  'border-top-color'                             the value
  14630.  'border-right-color'                           of the
  14631.  'border-bottom-color'  <color> | inherit       'color'                      no                               visual
  14632.  'border-left-color'                            property
  14633.  'border-top-style'
  14634.  'border-right-style'   <border-style> |
  14635.  'border-bottom-style'  inherit                 none                         no                               visual
  14636.  'border-left-style'
  14637.  'border-top-width'
  14638.  'border-right-width'   <border-width> |
  14639.  'border-bottom-width'  inherit                 medium                       no                               visual
  14640.  'border-left-width'
  14641.                                                 see
  14642.  'border-width'         <border-width>{1,4} |   individual                   no                               visual
  14643.                         inherit
  14644.                                                 properties
  14645.  
  14646.  'bottom'               <length> | <percentage> auto        positioned       no        refer to height of     visual
  14647.                         | auto | inherit                    elements                   containing block
  14648.  
  14649.  'caption-side'         top | bottom | left |   top         'table-caption'  yes                              visual
  14650.                         right | inherit                     elements
  14651.  
  14652.  'clear'                none | left | right |   none        block-level      no                               visual
  14653.                         both | inherit                      elements
  14654.                                                             block-level and
  14655.  'clip'                 <shape> | auto |        auto        replaced         no                               visual
  14656.                         inherit
  14657.                                                             elements
  14658.  
  14659.  'color'                <color> | inherit       depends on                   yes                              visual
  14660.                                                 user agent
  14661.                         [ <string> | <uri> |
  14662.                         <counter> | attr(X) |
  14663.                         open-quote |                        :before and
  14664.  'content'              close-quote |           empty       :after           no                               all
  14665.                         no-open-quote |         string      pseudo-elements
  14666.                         no-close-quote ]+ |
  14667.                         inherit
  14668.                         [ <identifier>
  14669.  'counter-increment'    <integer>? ]+ | none |  none                         no                               all
  14670.                         inherit
  14671.                         [ <identifier>
  14672.  'counter-reset'        <integer>? ]+ | none |  none                         no                               all
  14673.                         inherit
  14674.  
  14675.  'cue'                  [ 'cue-before' ||       XX                           no                               aural
  14676.                         'cue-after' ] | inherit
  14677.  'cue-after'            <uri> | none | inherit  none                         no                               aural
  14678.  'cue-before'           <uri> | none | inherit  none                         no                               aural
  14679.                         [ [<uri> ,]* [ auto |
  14680.                         crosshair | default |
  14681.                         pointer | move |
  14682.                         e-resize | ne-resize |
  14683.  'cursor'               nw-resize | n-resize |  auto                         yes                              visual,
  14684.                         se-resize | sw-resize |                                                               interactive
  14685.                         s-resize | w-resize|
  14686.                         text | wait | help ] ]
  14687.                         | inherit
  14688.  
  14689.  'direction'            ltr | rtl | inherit     ltr         all elements,    yes                              visual
  14690.                                                             but see prose
  14691.                         inline | block |
  14692.                         list-item | run-in |
  14693.                         compact | marker |
  14694.                         table | inline-table |
  14695.                         table-row-group |
  14696.                         table-header-group |
  14697.  'display'              table-footer-group |    inline                       no                               all
  14698.                         table-row |
  14699.                         table-column-group |
  14700.                         table-column |
  14701.                         table-cell |
  14702.                         table-caption | none |
  14703.                         inherit
  14704.                         <angle> | below | level
  14705.  'elevation'            | above | higher |      level                        yes                              aural
  14706.                         lower | inherit
  14707.  
  14708.  'empty-cells'          show | hide | inherit   show        'table-cell'     yes                              visual
  14709.                                                             elements
  14710.                                                             all but
  14711.                                                             positioned
  14712.  'float'                left | right | none |   none        elements and     no                               visual
  14713.                         inherit
  14714.                                                             generated
  14715.                                                             content
  14716.                         [ [ 'font-style' ||
  14717.                         'font-variant' ||
  14718.                         'font-weight' ]?
  14719.                         'font-size' [ /
  14720.                                                 see
  14721.  'font'                 'line-height' ]?        individual                   yes       allowed on 'font-size' visual
  14722.                         'font-family' ] |                                              and 'line-height'
  14723.                         caption | icon | menu | properties
  14724.                         message-box |
  14725.                         small-caption |
  14726.                         status-bar | inherit
  14727.                         [[ <family-name> |
  14728.                         <generic-family> ],]*
  14729.  'font-family'          [<family-name> |        depends on                   yes                              visual
  14730.                         <generic-family>] |     user agent
  14731.                         inherit
  14732.                         <absolute-size> |                                    yes, the
  14733.  'font-size'            <relative-size> |       medium                       computed  refer to parent        visual
  14734.                         <length> | <percentage>                              value is  element's font size
  14735.                         | inherit                                            inherited
  14736.  
  14737.  'font-size-adjust'     <number> | none |       none                         yes                              visual
  14738.                         inherit
  14739.                         normal | wider |
  14740.                         narrower |
  14741.                         ultra-condensed |
  14742.                         extra-condensed |
  14743.                         condensed |
  14744.  'font-stretch'         semi-condensed |        normal                       yes                              visual
  14745.                         semi-expanded |
  14746.                         expanded |
  14747.                         extra-expanded |
  14748.                         ultra-expanded |
  14749.                         inherit
  14750.  
  14751.  'font-style'           normal | italic |       normal                       yes                              visual
  14752.                         oblique | inherit
  14753.  
  14754.  'font-variant'         normal | small-caps |   normal                       yes                              visual
  14755.                         inherit
  14756.                         normal | bold | bolder
  14757.                         | lighter | 100 | 200 |
  14758.  'font-weight'          300 | 400 | 500 | 600 | normal                       yes                              visual
  14759.                         700 | 800 | 900 |
  14760.                         inherit
  14761.                                                             all elements but
  14762.                                                             non-replaced
  14763.  'height'               <length> | <percentage> auto        inline elements, no        see prose              visual
  14764.                         | auto | inherit                    table columns,
  14765.                                                             and column
  14766.                                                             groups
  14767.  
  14768.  'left'                 <length> | <percentage> auto        positioned       no        refer to width of      visual
  14769.                         | auto | inherit                    elements                   containing block
  14770.  
  14771.  'letter-spacing'       normal | <length> |     normal                       yes                              visual
  14772.                         inherit
  14773.                         normal | <number> |
  14774.  'line-height'          <length> | <percentage> normal                       yes       refer to the font size visual
  14775.                         | inherit                                                      of the element itself
  14776.                         [ 'list-style-type' ||
  14777.                                                             elements with
  14778.  'list-style'           'list-style-position'   XX          'display:        yes                              visual
  14779.                         || 'list-style-image' ]
  14780.                         | inherit                           list-item'
  14781.                                                             elements with
  14782.  'list-style-image'     <uri> | none | inherit  none        'display:        yes                              visual
  14783.                                                             list-item'
  14784.                                                             elements with
  14785.  'list-style-position'  inside | outside |      outside     'display:        yes                              visual
  14786.                         inherit
  14787.                                                             list-item'
  14788.                         disc | circle | square
  14789.                         | decimal |
  14790.                         decimal-leading-zero |
  14791.                         lower-roman |
  14792.                         upper-roman |
  14793.                         lower-greek |
  14794.                         lower-alpha |
  14795.                                                             elements with
  14796.  'list-style-type'      lower-latin |           disc        'display:        yes                              visual
  14797.                         upper-alpha |
  14798.                         upper-latin | hebrew |              list-item'
  14799.                         armenian | georgian |
  14800.                         cjk-ideographic |
  14801.                         hiragana | katakana |
  14802.                         hiragana-iroha |
  14803.                         katakana-iroha | none |
  14804.                         inherit
  14805.  
  14806.  'margin'               <margin-width>{1,4} |   XX                           no        refer to width of      visual
  14807.                         inherit                                                        containing block
  14808.  'margin-top'
  14809.  'margin-right'         <margin-width> |                                               refer to width of
  14810.  'margin-bottom'        inherit                 0                            no        containing block       visual
  14811.  'margin-left'
  14812.                                                             elements with
  14813.  'marker-offset'        <length> | auto |       auto        'display:        no                               visual
  14814.                         inherit
  14815.                                                             marker'
  14816.  
  14817.  'marks'                [ crop || cross ] |     none        page context     N/A                              visual,
  14818.                         none | inherit                                                                        paged
  14819.                                                             all elements
  14820.                                                             except
  14821.  'max-height'           <length> | <percentage> none        non-replaced     no        refer to height of     visual
  14822.                         | none | inherit                    inline elements            containing block
  14823.                                                             and table
  14824.                                                             elements
  14825.                                                             all elements
  14826.                                                             except
  14827.  'max-width'            <length> | <percentage> none        non-replaced     no        refer to width of      visual
  14828.                         | none | inherit                    inline elements            containing block
  14829.                                                             and table
  14830.                                                             elements
  14831.                                                             all elements
  14832.                                                             except
  14833.  'min-height'           <length> | <percentage> 0           non-replaced     no        refer to height of     visual
  14834.                         | inherit                           inline elements            containing block
  14835.                                                             and table
  14836.                                                             elements
  14837.                                                             all elements
  14838.                                                             except
  14839.  'min-width'            <length> | <percentage> UA          non-replaced     no        refer to width of      visual
  14840.                         | inherit               dependent   inline elements            containing block
  14841.                                                             and table
  14842.                                                             elements
  14843.  
  14844.  'orphans'              <integer> | inherit     2           block-level      yes                              visual,
  14845.                                                             elements                                          paged
  14846.                         [ 'outline-color' ||
  14847.                                                 see
  14848.  'outline'              'outline-style' ||      individual                   no                               visual,
  14849.                         'outline-width' ] |                                                                   interactive
  14850.                         inherit                 properties
  14851.  
  14852.  'outline-color'        <color> | invert |      invert                       no                               visual,
  14853.                         inherit                                                                               interactive
  14854.  
  14855.  'outline-style'        <border-style> |        none                         no                               visual,
  14856.                         inherit                                                                               interactive
  14857.  
  14858.  'outline-width'        <border-width> |        medium                       no                               visual,
  14859.                         inherit                                                                               interactive
  14860.                                                             block-level and
  14861.  'overflow'             visible | hidden |      visible     replaced         no                               visual
  14862.                         scroll | auto | inherit
  14863.                                                             elements
  14864.  
  14865.  'padding'              <padding-width>{1,4} |  XX                           no        refer to width of      visual
  14866.                         inherit                                                        containing block
  14867.  'padding-top'
  14868.  'padding-right'        <padding-width> |                                              refer to width of
  14869.  'padding-bottom'       inherit                 0                            no        containing block       visual
  14870.  'padding-left'
  14871.  
  14872.  'page'                 <identifier> | auto     auto        block-level      yes                              visual,
  14873.                                                             elements                                          paged
  14874.  
  14875.  'page-break-after'     auto | always | avoid | auto        block-level      no                               visual,
  14876.                         left | right | inherit              elements                                          paged
  14877.  
  14878.  'page-break-before'    auto | always | avoid | auto        block-level      no                               visual,
  14879.                         left | right | inherit              elements                                          paged
  14880.  
  14881.  'page-break-inside'    avoid | auto | inherit  auto        block-level      yes                              visual,
  14882.                                                             elements                                          paged
  14883.                         [ [<time> |                                                    see descriptions of
  14884.  'pause'                <percentage>]{1,2} ] |  depends on                   no        'pause-before' and     aural
  14885.                         inherit                 user agent                             'pause-after'
  14886.  
  14887.  'pause-after'          <time> | <percentage> | depends on                   no        see prose              aural
  14888.                         inherit                 user agent
  14889.  
  14890.  'pause-before'         <time> | <percentage> | depends on                   no        see prose              aural
  14891.                         inherit                 user agent
  14892.                         <frequency> | x-low |
  14893.  'pitch'                low | medium | high |   medium                       yes                              aural
  14894.                         x-high | inherit
  14895.  'pitch-range'          <number> | inherit      50                           yes                              aural
  14896.  
  14897.  'play-during'          <uri> mix? repeat? |    auto                         no                               aural
  14898.                         auto | none | inherit
  14899.  
  14900.                         static | relative |                 all elements,
  14901.  'position'             absolute | fixed |      static      but not to       no                               visual
  14902.                         inherit                             generated
  14903.                                                             content
  14904.  
  14905.  'quotes'               [<string> <string>]+ |  depends on                   yes                              visual
  14906.                         none | inherit          user agent
  14907.  'richness'             <number> | inherit      50                           yes                              aural
  14908.  
  14909.  'right'                <length> | <percentage> auto        positioned       no        refer to width of      visual
  14910.                         | auto | inherit                    elements                   containing block
  14911.                         <length>{1,2} | auto |
  14912.  'size'                 portrait | landscape |  auto        the page context N/A                              visual,
  14913.                         inherit                                                                               paged
  14914.  
  14915.  'speak'                normal | none |         normal                       yes                              aural
  14916.                         spell-out | inherit
  14917.                                                             elements that
  14918.  'speak-header'         once | always | inherit once        have table       yes                              aural
  14919.                                                             header
  14920.                                                             information
  14921.  
  14922.  'speak-numeral'        digits | continuous |   continuous                   yes                              aural
  14923.                         inherit
  14924.  'speak-punctuation'    code | none | inherit   none                         yes                              aural
  14925.                         <number> | x-slow |
  14926.  'speech-rate'          slow | medium | fast |  medium                       yes                              aural
  14927.                         x-fast | faster |
  14928.                         slower | inherit
  14929.  'stress'               <number> | inherit      50                           yes                              aural
  14930.                                                             'table' and
  14931.  'table-layout'         auto | fixed | inherit  auto        'inline-table'   no                               visual
  14932.                                                             elements
  14933.  
  14934.                         left | right | center | depends on
  14935.  'text-align'           justify | <string> |    user agent  block-level      yes                              visual
  14936.                         inherit                 and writing elements
  14937.                                                 direction
  14938.                         none | [ underline ||
  14939.  'text-decoration'      overline ||             none                         no (see                          visual
  14940.                         line-through || blink ]                              prose)
  14941.                         | inherit
  14942.  
  14943.  'text-indent'          <length> | <percentage> 0           block-level      yes       refer to width of      visual
  14944.                         | inherit                           elements                   containing block
  14945.                         none | [<color> ||
  14946.                         <length> <length>
  14947.  'text-shadow'          <length>? ,]* [<color>  none                         no (see                          visual
  14948.                         || <length> <length>                                 prose)
  14949.                         <length>?] | inherit
  14950.                         capitalize | uppercase
  14951.  'text-transform'       | lowercase | none |    none                         yes                              visual
  14952.                         inherit
  14953.  
  14954.  'top'                  <length> | <percentage> auto        positioned       no        refer to height of     visual
  14955.                         | auto | inherit                    elements                   containing block
  14956.  
  14957.  'unicode-bidi'         normal | embed |        normal      all elements,    no                               visual
  14958.                         bidi-override | inherit             but see prose
  14959.                         baseline | sub | super
  14960.                         | top | text-top |
  14961.                                                             inline-level and           refer to the
  14962.  'vertical-align'       middle | bottom |       baseline    'table-cell'     no        'line-height' of the   visual
  14963.                         text-bottom |
  14964.                         <percentage> | <length>             elements                   element itself
  14965.                         | inherit
  14966.  
  14967.  'visibility'           visible | hidden |      inherit                      no                               visual
  14968.                         collapse | inherit
  14969.                         [[<specific-voice> |
  14970.                         <generic-voice> ],]*
  14971.  'voice-family'         [<specific-voice> |     depends on                   yes                              aural
  14972.                         <generic-voice> ] |     user agent
  14973.                         inherit
  14974.                         <number> | <percentage>
  14975.  'volume'               | silent | x-soft |     medium                       yes       refer to inherited     aural
  14976.                         soft | medium | loud |                                         value
  14977.                         x-loud | inherit
  14978.  
  14979.  'white-space'          normal | pre | nowrap | normal      block-level      yes                              visual
  14980.                         inherit                             elements
  14981.  
  14982.  'widows'               <integer> | inherit     2           block-level      yes                              visual,
  14983.                                                             elements                                          paged
  14984.                                                             all elements but
  14985.                                                             non-replaced
  14986.  'width'                <length> | <percentage> auto        inline elements, no        refer to width of      visual
  14987.                         | auto | inherit                                               containing block
  14988.                                                             table rows, and
  14989.                                                             row groups
  14990.  
  14991.  'word-spacing'         normal | <length> |     normal                       yes                              visual
  14992.                         inherit
  14993.  
  14994.  'z-index'              auto | <integer> |      auto        positioned       no                               visual
  14995.                         inherit                             elements
  14996.   ------------------------------------------------------------------------
  14997.   ------------------------------------------------------------------------
  14998.  
  14999.                         Appendix G. Descriptor index
  15000.  
  15001.        Name                       Values                   Initial value
  15002.  'ascent'         <number>                               undefined
  15003.  'baseline'       <number>                               0
  15004.  
  15005.  'bbox'           <number>, <number>, <number>,          undefined
  15006.                   <number>
  15007.  'cap-height'     <number>                               undefined
  15008.  'centerline'     <number>                               undefined
  15009.  'definition-src' <uri>                                  undefined
  15010.  'descent'        <number>                               undefined
  15011.                   [ <family-name> | <generic-family> ]
  15012.  'font-family'    [, [<family-name> | <generic-family>   depends on user
  15013.                   ]]*                                    agent
  15014.  'font-size'      all | <length> [, <length>]*           all
  15015.                   all | [ normal | ultra-condensed |
  15016.                   extra-condensed | condensed |
  15017.                   semi-condensed | semi-expanded |
  15018.                   expanded | extra-expanded |
  15019.  'font-stretch'   ultra-expanded ] [, [ normal |         normal
  15020.                   ultra-condensed | extra-condensed |
  15021.                   condensed | semi-condensed |
  15022.                   semi-expanded | expanded |
  15023.                   extra-expanded | ultra-expanded] ]*
  15024.  
  15025.  'font-style'     all | [ normal | italic | oblique ]    all
  15026.                   [, [normal | italic | oblique] ]*
  15027.  
  15028.  'font-variant'   [normal | small-caps] [,[normal |      normal
  15029.                   small-caps]]*
  15030.                   all | [normal | bold | 100 | 200 |
  15031.                   300 | 400 | 500 | 600 | 700 | 800 |
  15032.  'font-weight'    900] [, [normal | bold | 100 | 200 |   all
  15033.                   300 | 400 | 500 | 600 | 700 | 800 |
  15034.                   900]]*
  15035.  'mathline'       <number>                               undefined
  15036.  
  15037.  'panose-1'       [<integer>]{10}                        0 0 0 0 0 0 0 0 0
  15038.                                                          0
  15039.  'slope'          <number>                               0
  15040.                   [ <uri> [format(<string> [,
  15041.  'src'            <string>]*)] | <font-face-name> ] [,   undefined
  15042.                   <uri> [format(<string> [,
  15043.                   <string>]*)] | <font-face-name> ]*
  15044.  'stemh'          <number>                               undefined
  15045.  'stemv'          <number>                               undefined
  15046.  'topline'        <number>                               undefined
  15047.  'unicode-range'  <urange> [, <urange>]*                 U+0-7FFFFFFF
  15048.  'units-per-em'   <number>                               undefined
  15049.  
  15050.  'widths'         [<urange> ]? [<number> ]+ [,[<urange>  undefined
  15051.                   ]? <number> ]+]
  15052.  'x-height'       <number>                               undefined
  15053.   ------------------------------------------------------------------------
  15054.   ------------------------------------------------------------------------
  15055.  
  15056.                               Appendix H. Index
  15057.  
  15058. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  15059.  
  15060.    * :active, 2, 3
  15061.    * :after, 1, 2
  15062.    * :before, 1, 2, 3
  15063.    * :first, 1
  15064.    * :first-child, 1
  15065.    * :first-letter, 1
  15066.    * :first-line, 1
  15067.    * :focus, 1
  15068.    * :hover, 1
  15069.    * :lang, 1
  15070.    * :left, 1
  15071.    * :link, 1, 2
  15072.    * :right, 1
  15073.    * :visited, 1, 2
  15074.    * =, 1
  15075.    * ~=, 1
  15076.    * |=, 1
  15077.  
  15078.  
  15079.  
  15080.    * @charset, 1
  15081.    * @font-face, 1, 2, 3, 4, 5, 6, 7
  15082.    * @import, 1, 2, 3
  15083.    * @media, 1, 2, 3, 4
  15084.    * @page, 1
  15085.  
  15086.  
  15087.  
  15088.    * absolute length, 1
  15089.    * <absolute-size>
  15090.         o definition of, 1
  15091.    * absolutely positioned element, 1
  15092.    * abstract glyph, 1
  15093.    * active (pseudo-class), 1, 2
  15094.    * actual value, 1
  15095.    * after, 1
  15096.    * 'all' media group, 1
  15097.    * ancestor, 1
  15098.    * <angle>, 1, 2
  15099.         o definition of, 1
  15100.    * anonymous, 1
  15101.    * anonymous inline boxes, 1
  15102.    * armenian, 1
  15103.    * 'ascent' (descriptor), 1
  15104.    * aspect value, 1
  15105.    * at-rule, 1
  15106.    * at-rules, 1, 2
  15107.    * attr(), 1
  15108.    * attribute, 1
  15109.    * auditory icon, 1
  15110.    * 'aural' media group, 1
  15111.    * authoring tool, 1
  15112.    * automatic numbering, 1
  15113.    * 'azimuth', 1
  15114.  
  15115.  
  15116.  
  15117.    * 'background', 1
  15118.    * 'background-attachment', 1
  15119.    * 'background-color', 1
  15120.    * 'background-image', 1
  15121.    * 'background-position', 1
  15122.    * 'background-repeat', 1
  15123.    * backslash escapes, 1
  15124.    * 'baseline' (descriptor), 1
  15125.    * 'bbox' (descriptor), 1
  15126.    * before, 1
  15127.    * bicameral, 1
  15128.         o definition of, 1
  15129.    * bidirectionality (bidi), 1
  15130.    * 'bitmap' media group, 1
  15131.    * block, 1
  15132.    * block box, 1
  15133.    * 'block', definition of, 1
  15134.    * block-level element, 1
  15135.    * border edge, 1
  15136.    * 'border', 1
  15137.    * 'border-bottom', 1
  15138.    * 'border-bottom-color', 1
  15139.    * 'border-bottom-style', 1
  15140.    * 'border-bottom-width', 1
  15141.    * 'border-collapse', 1
  15142.    * 'border-color', 1
  15143.    * 'border-left', 1
  15144.    * 'border-left-color', 1
  15145.    * 'border-left-style', 1
  15146.    * 'border-left-width', 1
  15147.    * 'border-right', 1
  15148.    * 'border-right-color', 1
  15149.    * 'border-right-style', 1
  15150.    * 'border-right-width', 1
  15151.    * 'border-spacing', 1
  15152.    * <border-style>, 1
  15153.    * <border-style>, definition of, 1
  15154.    * 'border-style', 1
  15155.    * 'border-top', 1
  15156.    * 'border-top-color', 1
  15157.    * 'border-top-style', 1
  15158.    * 'border-top-width', 1
  15159.    * <border-width>
  15160.         o definition of, 1
  15161.    * 'border-width', 1
  15162.    * border
  15163.         o of a box, 1
  15164.    * <bottom>
  15165.         o definition of, 1
  15166.    * 'bottom', 1
  15167.    * box
  15168.         o border, 1
  15169.         o content, 1
  15170.         o content height, 1
  15171.         o content width, 1
  15172.         o height, 1
  15173.         o margin, 1
  15174.         o overflow, 1
  15175.         o padding, 1
  15176.         o width, 1
  15177.  
  15178.  
  15179.  
  15180.    * canvas, 1, 2
  15181.    * 'cap-height' (descriptor), 1
  15182.    * 'caption-side', 1
  15183.    * cascade, 1
  15184.    * case sensitivity, 1
  15185.    * 'centerline' (descriptor), 1
  15186.    * character, 1
  15187.    * character encoding, 1
  15188.         o default, 1
  15189.         o user agent's determination of, 1
  15190.    * child, 1
  15191.    * child selector, 1
  15192.    * circle, 1
  15193.    * cjk-ideographic, 1
  15194.    * 'clear', 1
  15195.    * 'clip', 1
  15196.    * clipping region, 1
  15197.    * close-quote, 1, 2
  15198.    * collapsing margin, 1
  15199.    * color, 1
  15200.    * <color>, 1, 2
  15201.         o definition of, 1
  15202.    * 'color', 1
  15203.    * combinator, 1, 2
  15204.    * comments, 1
  15205.    * compact, 1
  15206.    * compact box, 1
  15207.    * 'compact', definition of, 1
  15208.    * computed value, 1
  15209.    * conditional import, 1
  15210.    * conformance, 1, 2, 3, 4, 5, 6, 7, 8
  15211.    * containing block, 1, 2, 3
  15212.         o initial, 1
  15213.    * content, 1
  15214.    * content edge, 1
  15215.    * 'content', 1
  15216.    * content
  15217.         o of a box, 1
  15218.         o rendered, 1
  15219.    * 'continuous' media group, 1
  15220.    * <counter>, 1
  15221.    * <counter>, definition of, 1
  15222.    * counter(), 1
  15223.    * 'counter-increment', 1
  15224.    * 'counter-reset', 1
  15225.    * counters, 1
  15226.    * crop marks, 1
  15227.    * cross marks, 1
  15228.    * 'cue', 1
  15229.    * 'cue-after', 1
  15230.    * 'cue-before', 1
  15231.    * cursive, definition of, 1
  15232.    * 'cursor', 1
  15233.  
  15234.  
  15235.  
  15236.    * 'dashed', 1, 2
  15237.    * decimal, 1
  15238.    * decimal-leading-zero, 1
  15239.    * declaration, 1
  15240.    * declaration-block, 1
  15241.    * default style sheet, 1
  15242.    * default
  15243.         o character encoding, 1
  15244.    * 'definition-src' (descriptor), 1
  15245.    * descendant, 1
  15246.    * descendant-selectors, 1
  15247.    * 'descent' (descriptor), 1
  15248.    * 'direction', 1
  15249.    * disc, 1
  15250.    * 'display', 1
  15251.    * document language, 1
  15252.    * document tree, 1
  15253.    * 'dotted', 1, 2
  15254.    * 'double', 1, 2
  15255.    * drop caps, 1
  15256.    * DTD, 1, 2
  15257.  
  15258.  
  15259.  
  15260.    * element, 1
  15261.         o following, 1
  15262.         o preceding, 1
  15263.    * 'elevation', 1
  15264.    * em (unit), 1
  15265.    * em square, 1, 2
  15266.    * empty, 1
  15267.    * 'empty-cells', 1
  15268.    * encoding vector, 1
  15269.    * ex (unit), 1
  15270.    * exact matching, 1
  15271.  
  15272.  
  15273.  
  15274.    * <family-name>
  15275.         o definition of, 1
  15276.    * fantasy, definition of, 1
  15277.    * fictional tag sequence, 1, 2, 3
  15278.    * first-child, 1
  15279.    * first-letter, 1
  15280.    * first-line, 1
  15281.    * float rules, 1
  15282.    * 'float', 1
  15283.    * focus, 1
  15284.    * focus (pseudo-class), 1
  15285.    * following element, 1
  15286.    * font, 1
  15287.    * font data, 1
  15288.    * font definition resource, 1
  15289.    * font description, 1
  15290.    * font download, 1
  15291.    * font encoding table, 1
  15292.    * font family, 1
  15293.    * font set, 1
  15294.    * font synthesis, 1
  15295.    * 'font', 1
  15296.    * <font-description>
  15297.         o definition of, 1
  15298.    * <font-face-name>
  15299.         o definition of, 1
  15300.    * 'font-family', 1
  15301.    * 'font-family' (descriptor), 1
  15302.    * 'font-size', 1
  15303.    * 'font-size' (descriptor), 1
  15304.    * 'font-size-adjust', 1
  15305.    * 'font-stretch', 1
  15306.    * 'font-stretch' (descriptor), 1
  15307.    * 'font-style', 1
  15308.    * 'font-style' (descriptor), 1
  15309.    * 'font-variant', 1
  15310.    * 'font-variant' (descriptor), 1
  15311.    * 'font-weight', 1
  15312.    * 'font-weight' (descriptor), 1
  15313.    * forced line break, 1
  15314.    * formatting context, 1
  15315.    * formatting structure, 1
  15316.    * forward-compatible parsing, 1
  15317.    * <frequency>, 1
  15318.         o definition of, 1
  15319.    * full font name, 1
  15320.  
  15321.  
  15322.  
  15323.    * generated content, 1
  15324.    * <generic-family>
  15325.         o definition of, 1
  15326.    * <generic-voice>, definition of, 1
  15327.    * georgian, 1
  15328.    * glyph, 1
  15329.    * 'grid' media group, 1
  15330.    * 'groove', 1, 2
  15331.  
  15332.  
  15333.  
  15334.    * half-leading, 1
  15335.    * hebrew, 1
  15336.    * 'height', 1
  15337.    * 'hidden, 1
  15338.    * 'hidden', 1
  15339.    * hiragana, 1
  15340.    * hiragana-iroha, 1
  15341.    * horizontal margin, 1
  15342.    * hover (pseudo-class), 1
  15343.    * hyphen-separated matching, 1
  15344.  
  15345.  
  15346.  
  15347.    * identifier, 1
  15348.    * identifier, definition of, 1
  15349.    * ignore, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
  15350.      19, 20, 21, 22, 23, 24, 25, 26, 27
  15351.    * illegal, 1
  15352.    * important, 1
  15353.    * inherit, definition of, 1
  15354.    * initial caps, 1
  15355.    * initial containing block, 1
  15356.    * initial value, 1
  15357.    * 'inline', definition of, 1
  15358.    * inline-level element, 1
  15359.    * inline-table, 1
  15360.    * 'inline-table', 1
  15361.    * inner edge, 1
  15362.    * 'inset', 1, 2
  15363.    * <integer>, 1
  15364.         o definition of, 1
  15365.    * intelligent font matching, 1
  15366.    * 'interactive media group, 1
  15367.    * internal table element, 1
  15368.    * intrinsic dimensions, 1
  15369.    * invert, 1
  15370.    * iso-10646, 1
  15371.    * Italic, definition of, 1
  15372.  
  15373.  
  15374.  
  15375.    * katakana, 1
  15376.    * katakana-iroha, 1
  15377.  
  15378.  
  15379.  
  15380.    * lang (pseudo-class), 1
  15381.    * language (human), 1
  15382.    * language code, 1, 2
  15383.    * leading, 1
  15384.    * <left>
  15385.         o definition of, 1
  15386.    * 'left', 1
  15387.    * <length>, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
  15388.         o definition of, 1
  15389.    * 'letter-spacing', 1
  15390.    * ligatures, 1
  15391.    * line box, 1
  15392.    * line-box, 1
  15393.    * 'line-height', 1
  15394.    * link (pseudo-class), 1, 2
  15395.    * list properties, 1
  15396.    * 'list-item', definition of, 1
  15397.    * 'list-style', 1
  15398.    * 'list-style-image', 1
  15399.    * 'list-style-position', 1
  15400.    * 'list-style-type', 1
  15401.    * LL(1), 1
  15402.    * local stacking context, 1
  15403.    * lower-greek, 1
  15404.    * lower-latin, 1
  15405.    * lower-roman, 1
  15406.  
  15407.  
  15408.  
  15409.    * mapping elements to table parts, 1
  15410.    * margin edge, 1
  15411.    * 'margin', 1
  15412.    * 'margin-bottom', 1
  15413.    * 'margin-left', 1
  15414.    * 'margin-right', 1
  15415.    * 'margin-top', 1
  15416.    * <margin-width>
  15417.         o definition of, 1
  15418.    * margin
  15419.         o horizontal, 1
  15420.         o of a box, 1
  15421.         o vertical, 1
  15422.    * marker', definition of, 1
  15423.    * 'marker-offset', 1
  15424.    * markers, 1
  15425.    * 'marks', 1
  15426.    * match, 1
  15427.    * 'mathline' (descriptor), 1
  15428.    * 'max-height', 1
  15429.    * 'max-width', 1
  15430.    * MAY, 1
  15431.    * media, 1
  15432.    * media group, 1
  15433.    * media type, 1
  15434.    * media-dependent import, 1
  15435.    * message entity, 1
  15436.    * 'min-height', 1
  15437.    * 'min-width', 1
  15438.    * monospace, definition of, 1
  15439.    * multiple declarations, 1
  15440.    * MUST, 1
  15441.    * MUST NOT, 1
  15442.  
  15443.  
  15444.  
  15445.    * name matching, 1
  15446.    * newline, 1
  15447.    * no-close-quote, 1, 2
  15448.    * no-open-quote, 1, 2
  15449.    * 'none'
  15450.         o as border style, 1, 2
  15451.         o as display value, 1
  15452.    * <number>, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
  15453.         o definition of, 1
  15454.  
  15455.  
  15456.  
  15457.    * open-quote, 1, 2
  15458.    * OPTIONAL, 1
  15459.    * 'orphans', 1
  15460.    * outer edge, 1
  15461.    * outline, 1
  15462.    * 'outline', 1
  15463.    * 'outline-color', 1
  15464.    * 'outline-style', 1
  15465.    * 'outline-width', 1
  15466.    * 'outset', 1, 2
  15467.    * overflow, 1
  15468.    * 'overflow', 1
  15469.  
  15470.  
  15471.  
  15472.    * padding edge, 1
  15473.    * 'padding', 1
  15474.    * 'padding-bottom', 1
  15475.    * 'padding-left', 1
  15476.    * 'padding-right', 1
  15477.    * 'padding-top', 1
  15478.    * <padding-width>
  15479.         o definition of, 1
  15480.    * padding
  15481.         o of a box, 1
  15482.    * page area, 1
  15483.    * page box, 1
  15484.    * page model, 1
  15485.    * page selector, 1
  15486.    * 'page', 1
  15487.    * 'page-break-after', 1
  15488.    * 'page-break-before', 1
  15489.    * 'page-break-inside', 1
  15490.    * page-context, 1
  15491.    * 'paged' media group, 1
  15492.    * Panose-1, 1
  15493.    * panose-1, 1
  15494.    * 'panose-1' (descriptor), 1
  15495.    * parent, 1
  15496.    * 'pause', 1
  15497.    * 'pause-after', 1
  15498.    * 'pause-before', 1
  15499.    * <percentage>, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
  15500.         o definition of, 1
  15501.    * 'pitch', 1
  15502.    * 'pitch-range', 1
  15503.    * pixel, 1
  15504.    * 'play-during', 1
  15505.    * 'position', 1
  15506.    * positioned element/box, 1
  15507.    * positioning scheme, 1
  15508.    * preceding element, 1
  15509.    * principal block box, 1
  15510.    * progressive rendering, 1
  15511.    * property, 1
  15512.    * pseudo-class
  15513.         o :first, 1
  15514.         o :left, 1
  15515.         o :right, 1
  15516.    * pseudo-classes, 1
  15517.         o :active, 1, 2
  15518.         o :focus, 1
  15519.         o :hover, 1
  15520.         o :lang, 1
  15521.         o :link, 1, 2
  15522.         o :visited, 1, 2
  15523.    * pseudo-elements, 1
  15524.         o :after, 1, 2
  15525.         o :before, 1, 2
  15526.         o :first-letter, 1
  15527.         o :first-line, 1, 2
  15528.  
  15529.  
  15530.  
  15531.    * quad width, 1
  15532.    * 'quotes', 1
  15533.  
  15534.  
  15535.  
  15536.    * RECOMMENDED, 1
  15537.    * reference pixel, 1
  15538.    * relative positioning, 1
  15539.    * relative units, 1
  15540.    * <relative-size>
  15541.         o definition of, 1
  15542.    * rendered content, 1
  15543.    * replaced element, 1
  15544.    * REQUIRED, 1
  15545.    * Resource Identifier (URI), 1
  15546.    * 'richness', 1
  15547.    * 'ridge', 1, 2
  15548.    * <right>
  15549.         o definition of, 1
  15550.    * 'right', 1
  15551.    * root, 1
  15552.    * root stacking context, 1
  15553.    * rule sets, 1
  15554.    * run-in, 1
  15555.    * run-in box, 1
  15556.    * 'run-in', definition of, 1
  15557.  
  15558.  
  15559.  
  15560.    * sans-serif, definition of, 1
  15561.    * scope, 1
  15562.    * screen reader, 1
  15563.    * selector, 1, 2, 3, 4
  15564.         o match, 1
  15565.         o subject of, 1
  15566.    * separated borders, 1
  15567.    * serif, definition of, 1
  15568.    * SHALL, 1
  15569.    * SHALL NOT, 1
  15570.    * <shape>
  15571.         o definition of, 1
  15572.    * sheet, 1
  15573.    * shorthand property, 1, 2, 3
  15574.    * SHOULD, 1
  15575.    * SHOULD NOT, 1
  15576.    * sibling, 1
  15577.    * simple selector, 1
  15578.    * 'size', 1
  15579.    * 'slope' (descriptor), 1
  15580.    * 'solid', 1, 2
  15581.    * source document, 1
  15582.    * space-separated matching, 1
  15583.    * 'speak', 1
  15584.    * 'speak-header', 1
  15585.    * 'speak-numeral', 1
  15586.    * 'speak-punctuation', 1
  15587.    * <specific-voice>
  15588.         o definition of, 1
  15589.    * specified value, 1
  15590.    * 'speech-rate', 1
  15591.    * square, 1
  15592.    * 'src' (descriptor), 1
  15593.    * stack level, 1
  15594.    * stacking context, 1
  15595.    * statements, 1
  15596.    * 'static' media group, 1
  15597.    * 'stemh' (descriptor), 1
  15598.    * 'stemv' (descriptor), 1
  15599.    * 'stress', 1
  15600.    * string, 1
  15601.    * <string>, 1, 2, 3, 4, 5
  15602.    * <string>, definition of, 1
  15603.    * style sheet, 1
  15604.    * subject (of selector), 1
  15605.    * system fonts, 1
  15606.  
  15607.  
  15608.  
  15609.    * table, 1
  15610.    * table element, 1
  15611.         o internal, 1
  15612.    * 'table', 1
  15613.    * table-caption, 1
  15614.    * 'table-caption', 1
  15615.    * table-cell, 1
  15616.    * 'table-cell', 1
  15617.    * table-column, 1
  15618.    * 'table-column', 1
  15619.    * table-column-group, 1
  15620.    * 'table-column-group', 1
  15621.    * table-footer-group, 1
  15622.    * 'table-footer-group', 1
  15623.    * table-header-group, 1
  15624.    * 'table-header-group', 1
  15625.    * 'table-layout', 1
  15626.    * table-row, 1
  15627.    * 'table-row', 1
  15628.    * table-row-group, 1
  15629.    * 'table-row-group', 1
  15630.    * tables, 1
  15631.    * 'tactile' media group, 1
  15632.    * 'text-align', 1
  15633.    * 'text-decoration', 1
  15634.    * 'text-indent', 1
  15635.    * 'text-shadow', 1
  15636.    * 'text-transform', 1
  15637.    * text/css, 1
  15638.    * <time>, 1
  15639.         o definition of, 1
  15640.    * tokenizer, 1
  15641.    * <top>
  15642.         o definition of, 1
  15643.    * 'top', 1
  15644.    * 'topline' (descriptor), 1
  15645.    * type selector, 1
  15646.  
  15647.  
  15648.  
  15649.    * UA, 1
  15650.    * unicameral, 1, 2
  15651.         o definition of, 1
  15652.    * unicode, 1
  15653.    * 'unicode-bidi', 1
  15654.    * 'unicode-range' (descriptor), 1
  15655.    * Uniform Resource Locator (URL), 1
  15656.    * Uniform Resource Name (URN), 1
  15657.    * 'units-per-em' (descriptor), 1
  15658.    * universal selector, 1
  15659.    * upper-latin, 1
  15660.    * upper-roman, 1
  15661.    * <urange>
  15662.         o definition of, 1
  15663.    * URI (Uniform Resource Identifier), 1
  15664.    * <uri>, 1, 2, 3, 4, 5, 6
  15665.         o definition of, 1
  15666.    * URL (Uniform Resource Locator), 1
  15667.    * URN (Uniform Resource Name), 1
  15668.    * user agent, 1
  15669.  
  15670.  
  15671.  
  15672.    * valid style sheet, 1
  15673.    * value, 1
  15674.    * vertical margin, 1
  15675.    * 'vertical-align', 1
  15676.    * viewport, 1
  15677.    * 'visibility', 1
  15678.    * visited (pseudo-class), 1, 2
  15679.    * visual formatting model, 1
  15680.    * 'visual' media group, 1
  15681.    * 'voice-family', 1
  15682.    * volume, 1
  15683.    * 'volume', 1
  15684.  
  15685.  
  15686.  
  15687.    * 'white-space', 1
  15688.    * 'widows', 1
  15689.    * 'width', 1
  15690.    * 'widths' (descriptor), 1
  15691.    * 'word-spacing', 1
  15692.  
  15693.  
  15694.  
  15695.    * x-height, 1
  15696.    * 'x-height' (descriptor), 1
  15697.  
  15698.  
  15699.  
  15700.    * 'z-index', 1
  15701.  
  15702.   ------------------------------------------------------------------------
  15703.