Contents
C.1.3 Changes Section 6.4.3 Calculating a selector's specificity Section 6.4.4 Precedence of non-CSS presentational hints Chapter 9 Visual formatting model Section 10.3.7 Absolutely positioned, non-replaced elements Section 10.6.4 Absolutely positioned, non-replaced elements Section 11.1.2 17.4.1 Caption position and alignment Section 17.6 Borders Chapter 12 Generated content, automatic numbering, and lists Section 12.2 The 'content' property Chapter 15 Fonts Section 18.1 Cursors: the 'cursor' property Chapter 16 Text Appendix A. Aural style sheets Page breaks OtherThis appendix is informative, not normative.
C.1 Changes from CSS2CSS 2.1 is an updated version of CSS2. The changes between the
CSS2 specification (see [CSS2]) and this specification fall into
fourfive groups: known errors, typographical errors, clarifications,
changes and changes. C.1.1additions. Typographical errors Shorthand properties Shorthand properties take a list of subproperty values or the value 'inherit'. One cannot mix 'inherit' with other subproperty values as it wouldare not be possible to specifylisted here.
New color value: 'orange'
New 'display' value: 'inline-block'
New 'cursor' value: 'progress'
New 'white-space' values: 'pre-wrap' and 'pre-line'
Support for user style sheets is now required (in most cases), rather than just recommended.
The "style" attribute now has a higher specificity than any style rule.
"Non-CSS presentational hints" no longer exist, with the exception of a small set of attributes in HTML.
The value 'compact' for 'display' does not exist in CSS 2.1.
Absolutely positioned elements can now "shrink-wrap" their contents:
When both 'width' and 'right' (or 'width' and 'left') are 'auto', the element's computed width is the width of the contents (using an algorithm similar to that for table cells) and then 'right' (or 'left') is solved. CSS2 incorrectly said that 'right' (or 'left') was set to 0 in that case, and then width was solved.
Like normal-flow block-level elements, absolutely positioned elements by default take on the height of their contents ("shrink-wrap"). If 'height' and 'bottom' are both 'auto', the computed value of 'height' is set to the height of the contents and then 'bottom' is solved. CSS2 incorrectly said the reverse: 'bottom' was set to 0 and then height was solved.
While CSS2 specified that values of "rect()" give offsets from the respective sides of the box, current implementations interpret values with respect to the top and left edges for all four values (top, right, bottom, and left). This is now the correct interpretation.
The 'left' and 'right' values on 'caption-side' have been removed.
The <string> value for 'text-align' is not part of CSS 2.1.
Several popular browsers assume an initial value for 'border-collapse' of 'separate' rather than 'collapse' or exhibit behavior that is close to that value, even if they do not actually implement the CSS table model. 'Separate' is now the initial value.
The 'marker' value for 'display' does not exist in CSS 2.1
The '<uri>' value is dropped.
The 'size', 'marks' and 'page' properties are not in CSS 2.1.
The 'font-stretch' and 'font-size-adjust' properties don't exist in CSS 2.1.
Font descriptors and the '@font-face' declaration don't exist in CSS 2.1.
The 'text-shadow' property is not in CSS 2.1.
Chapter 19 on aural style sheets has become appendix A and is not normative in CSS 2.1. Related units (deg, grad, rad, ms, s, Hz, kHz) are also moved to this appendix, as is the 'speak-header' property from the "tables" chapter.
The former informative appendix C, "Implementation and performance notes for fonts," is left out of CSS 2.1.
Shorthand properties take a list of subproperty values or the value 'inherit'. One cannot mix 'inherit' with other subproperty values as it would not be possible to specify the subproperty to which 'inherit' applied. The definitions of a number of shorthand properties did not enforce this rule: 'border-top', 'border-right', 'border-bottom', 'border-left', 'border', 'background', 'font', 'list-style', 'cue', and 'outline'.
The underscore character ("_") is allowed in identifiers. The definitions of the lexical macros "nmstart" and "nmchar" now include it.
In the third bullet, added to point 1:
1.with a space (or other whitespace character): "\26 B" ("&B")
the following text: "In this case, user agents should treat a "CR/LF" pair (13/10) as a single whitespace character."
The underscore is allowed in identifiers. Changed "In CSS2, identifiers [...] can contain only the characters [A-Za-z0-9] and ISO 10646 characters 161 and higher, plus the hyphen (-)" to:
In CSS2, identifiers [...] contain only the characters [A-Za-z0-9] and ISO 10646 characters 161 and higher, plus the hyphen (-) and the underscore (_)
Several values described in subsections of this section incorrectly allowed two "+" or "-" signs at their beginnings.
The suggested reference pixel is based on a 96 dpi device, not 90 dpi. The visual angle is thus about 0.0213 degrees instead of 0.0227, and a pixel at arm's length is about 0.26 mm instead of 0.28
Deleted the comments about range restriction after the following examples:
em { color: rgb(255,0,0) } em { color: rgb(100%, 0%, 0%) }
In the second bullet, the following sentence was incomplete: "The exception is ':first-child', which can be deduced from the document tree." The ':lang()' pseudo-class can be deduced from the document in some cases.
The colors in the example HTML did not match the colors in the image.
The value 'transparent' is also allowed on 'border-top-color', 'border-right-color', etc. Changed the line "Value: <color> | inherit" to
Value: <color> | transparent | inherit
The five properties related to padding ('padding', 'padding-top', 'padding-right', 'padding-bottom', and 'padding-left') now say that they don't apply to table rows, row groups, header groups, footer groups, columns, and column groups.
Changed the sentence "The color of borders drawn for values of 'groove', 'ridge', 'inset', and 'outset' depends on the element's 'color' property" to
The color of borders drawn for values of 'groove', 'ridge', 'inset', and 'outset' should be based on the element's 'border-color' property, but UAs may choose their own algorithm to calculate the actual colors used. For instance, if the 'border-color' has the value 'silver', then a UA could use a gradient of colors from white to dark gray to indicate a sloping border.
Changed <'border-top-width'> to <border-width> as the first value option for 'border-top', 'border-right', 'border-bottom', and 'border-left', and changed <'border-style'> to <border-style>. For 'border', changed <'border-width'> to <border-width> and <'border-style'> to <border-style>.
The value 'transparent' is also allowed on 'border-top', 'border-bottom', 'border-right', 'border-left', and 'border'.
Changed the two lines "Value: [ <'border-top-width'> || <'border-style'> || <color> | inherit" to
Value: [ <border-top-width> || <border-style> || [<color> | transparent] | inherit
Changed <'border-top-width'> to <border-width> as the first value option for 'border-top', 'border-right', 'border-bottom', and 'border-left', and changed <'border-style'> to <border-style>. For 'border', changed <'border-width'> to <border-width> and <'border-style'> to <border-style>.
The definition of the value 'static' now says that the properties 'top', 'right', 'bottom', and 'left' do not apply.
The properties 'top', 'right', 'bottom', and 'left', incorrectly referred to offsets with respect to a box's content edge. The proper edge is the margin edge. Thus, for 'top', the description now reads: "This property specifies how far a box's top margin edge is offset below the top edge of the box's containing block."
In the first sentence, added to the end of "Once a box has been laid out according to the normal flow" the words "or floated,".
If an element floats, the 'display' property is set to a block-level value, but not necessarily 'block'. In bullet 3, changed "Otherwise, if 'float' has a value other than 'none', 'display' is set to 'block' and the box is floated" to a table with the proper computed values.
Changed:
A specified value of 'auto' for 'width' gives the element's intrinsic width as the computed value.
to:
If 'width' has a specified value of 'auto' and 'height' also has a specified value of 'auto', the element's intrinsic width is the computed value of 'width'. If 'width' has a specified value of 'auto' and 'height' has some other specified value, then the computed value of 'width' is (intrinsic width) * ( (computed height) / (intrinsic height) ).
In the last sentence of the paragraph following the equation ("If the value of 'direction' is 'ltr', this happens to 'margin-left' instead") substituted 'rtl' for 'ltr'.
Changed:
If 'height' is 'auto', the computed value is the intrinsic height.
to:
If 'height' has a specified value of 'auto' and 'width' also has a specified value of 'auto', the element's intrinsic height is the computed value of 'height'. If 'height' has a specified value of 'auto' and 'width' has some other specified value, then the computed value of 'height' is (intrinsic height) * ( (computed width) / (intrinsic width) ).
The height calculation for block-level, non-replaced elements in normal flow, and floating, non-replaced elements was not quite correct. It now takes into account the case when margins do not collapse, due to the presence of a padding or border.
The example of a DIV element containing a BLOCKQUOTE containing another DIV was not rendered correctly. The first style rule applied to both DIVs, so the second DIV box should have been rendered with a red border as well. The second DIV has now been changed to a CITE, which doesn't have a red border.
Changed "initial" and "inherited" to:
Initial: visible
Inherited: yes
This has the same effect as the original definition, but removes the undefined state of the root element (which was a problem for DOM implementations).
Under the 'list-style' property, the example:
ul > ul { list-style: circle outside } /* Any UL child of a UL */
could never match valid HTML markup (since a UL element cannot be a child of another UL element). An LI has been inserted in between.
'Totum' and 'Kodic' is not a 'serif' but 'sans-serif'. 'pathang' is not a 'sans-serif' but 'serif'.
In bullet 2, changed "the UA uses the 'font-family' descriptor" to "the UA uses the 'font-family' property".
In bullet 6, changed "steps 3, 4 and 5" to "steps 2, 3, 4 and 5".
The 'white-space' property applies to all elements, not just block-level elements.
In the definition of table-header-group, changed "footer" to "header" in "Print user agents may repeat footer rows on each page spanned by a table."
Moved the first bullet text to the prose before the list of generation rules and added missing rules.
The following note:
Note. Table cells may be relatively and absolutely positioned, but this is not recommended: positioning and floating remove a box from the flow, affecting table alignment.
has been amended as follows:
Note. Table cells may be positioned, but this is not recommended: absolute and fixed positioning, as well as floating, remove a box from the flow, affecting table size.
Changed:
Like other elements of the document language, internal table elements generate rectangular boxes with content, padding, and borders. They do not have margins, however.
to:
Like other elements of the document language, internal table elements generate rectangular boxes with content and borders. Cells have padding as well. Internal table elements do not have margins.
The rows and columns only cover the whole table in the collapsed borders model, not in the separated borders model. The points 2, 3, 4 and 5 have been corrected to define the area covered by rows, columns, row groups and column groups in terms of the cells they cover.
In the image, changed "cell-spacing" to "border-spacing".
The underscore character ("_") is be allowed in identifiers. The definitions of the lexical macros "nmstart" and "nmchar" have been fixed.
Note that the tokenizer is case-insensitive, so uppercase A-Z is matched as well.
(Same change in section 4.1.1, see above.)
The specification for the XML
style sheet PI
was written after CSS2 was finalized. The first line of the full XML
example should not have been be <?XML:stylesheet type="text/css"
href="bach.css"?>
, but
<?xml-stylesheet type="text/css" href="bach.css"?>
DELIM should not have included single or double quote. Refer also to section 4.1.6 on strings, which must have matching single or double quotes around them.
Near the end of the section, the text 'Note the whitespace on either side of the "*"' was misleading. The note was not meant to imply that whitespace is required on both sides of the "*" (since the grammar does not require it in this case) but that one may use whitespace in this case.
The word "precedence" in the last but one paragraph should have been "specificity."
Added some clarifications at the end of the section about the fictional tag sequence in the case of nested block-level elements
The 'inherit' value causes the properties value to be inherited. This applies even to properties for which values do not otherwise inherit.
Changed "Rules specified in a given style sheet override rules imported from other style sheets." to "Rules specified in a given style sheet override rules of the same weight imported from other style sheets."
Added a note:
The specificity is based only on the form of the selector. In particular, a selector of the form "
[id=p33]
" is counted as an attribute selector (a=0, b=1, c=0), even if theid
attribute is defined as an "ID" in the source document's DTD.
Text has been added to clarify that media types are mutually exclusive.
The background style of the content, padding, and border areas of a box is specified by the 'background' property of the generating element. Margin backgrounds are always transparent.
Added this clarifying note to the first bullet of the explanation of vertical collapsing of margins:
Note. Adjoining boxes may be generated by elements that are not related as siblings or ancestors.
The statement "When an inline box is split, margins, borders, and padding have no visual effect where the split occurs." has been generalized. Margins, borders, and padding have no visual effect where one or more splits occur.
Relatively positioned boxes do not always establish new containing blocks. Changed the second paragraph accordingly.
Added clarifying text and an example about the 'left', 'right', 'top' and 'bottom' properties for relative positioning.
In this sentence of the last paragraph:
Conforming HTML user agents may therefore ignore the 'direction' and 'unicode-bidi' properties in author and user style sheets.
the word "ignore" meant that if a 'unicode-bidi' or 'direction' value conflicts with the HTML 4.0 "dir" attribute value, then user agents may choose to use the "dir" value rather than the CSS properties.
User agents are not required to support the 'direction' and 'unicode-bidi' properties to conform to CSS2 unless they support bi-directional text rendering (except for the case of HTML 4.0 as noted above).
The sentence has been rewritten to be clearer.
Added the following note at the end of the section:
Note that 'width' may not be greater than 'max-width' and not less than 'min-width'. In particular, it may not be negative. See the rules in section 10.4 below.
The UA is free to chose the containing block for the root element (see 10.1), therefore this sentence has been added as a suggestion:
A UA may compute a percentage height on the root element relative to the viewport.
Clarified this paragraph:
Note that replaced elements have a 'font-size' and a 'line-height' property, even if they are not used directly to determine the height of the box. The 'font-size' is, however, used to define the 'em' and 'ex' units, and the 'line-height' has a role in the 'vertical-align' property.
as follows:
Note that replaced elements have a 'font-size' and a 'line-height' property, even if they are not used directly to determine the height of the box: 'em' and 'ex' values are relative to values of 'font-size' and percentage values for 'vertical-align' are relative to values of 'line-height'.
Under 'line-height', after the sentence "If the property is set on a block-level element whose content is composed of inline-level elements, it specifies the minimal height of each generated inline box," added the following clarification:
The minimum height consist of a minimum height above the block's baseline and a minimum depth below it, exactly as if each line box starts with a zero-width inline box with the block's font and line height properties (what TEX calls a "strut").
Clarifications to the last two bullets on when overflow may occur:
Removed 'projection' from this sentence under the value 'scroll'
When this value is specified and the target medium is 'print' or 'projection', overflowing content should be printed.
Values of "rect()" should be separated by commas. Thus, the definition of <shape> now starts:
In CSS2, the only valid <shape> value is: rect (<top>, <right>, <bottom>, <left>) ...
Due to this ambiguity, user agents may support separation of offsets in "rect()" with or without commas.
Clarification to the following lines:
The :before and :after pseudo-elements elements allow values of the 'display' property as follows:
- If the subject of the selector is a block-level element, allowed values are 'none', 'inline' and 'block'. If the value of the pseudo-element's 'display' property has any other value, the pseudo-element will behave as if its value were 'block'.
- If the subject of the selector is an inline-level element, allowed values are 'none' and 'inline'. If the value of the pseudo-element's 'display' property has any other value, the pseudo-element will behave as if its value were 'inline'.
Added the following sentence at the end of the 2nd paragraph:
A 'close-quote' that would make the depth negative is in error and is ignored: the depth stays at 0 and no quote mark is rendered (although the rest of the 'content' property's value is still inserted).
To clarify Hebrew numbering, added "(Alef, Bet, ... Tet Vav, Tet Zayin, ... Yod Tet, Kaf ...)".
Second sentence: "In terms of the box model, 'background' refers to the background of the content and the padding areas" now also mentions the border area. (See also errata to section 8.1 above.) Thus:
In terms of the box model, "background" refers to the background of the content, padding and border areas.
In the fourth paragraph, added to the end of "User agents should observe the following precedence rules to fill in the background" the following words: "of the canvas".
Added this note after the first paragraph after 'background-attachment':
Note that there is only one viewport per document. I.e., even if an element has a scrolling mechanism (see 'overflow'), a 'fixed' background doesn't move with it.
Under 'background-repeat', the sentence "All tiling covers the content and padding areas [...]" has been corrected to
"All tiling covers the content, padding and border areas [...]".
Under 'background-attachment', the sentence "Even if the image is fixed [...] background or padding area of the element" has been corrected to
Even if the image is fixed, it is still only visible when it is in the background, padding or border area of the element.
Added to:
The
marginsvalue ofatablearesetto'0'and'text-indent' may be negative, but there may be implementation-specific limits.
the width to 'auto',following clarification: "If the table will not automatically size to fill its containing block. However, oncevalue of 'text-indent'
is negative, the calculatedvalue of 'width' for'overflow' will affect whether the
tabletext is found (using the algorithms given below or, when appropriate, some other UA dependant algorithm) thenvisible."
Changed "double justify" to "justify" under "left, right, center, and justify".
In point 6, changed 'These "empty" cells are transparent' to:
If the
WGmayintroducewaysvalue ofautomaticallymakingtablesfittheircontainingblocksinCSS3.Bordersaroundemptycells:the'empty-cells' property is 'hide' these "empty" cells are transparent through the'empty-cells'propertynotonlycontrolstheborders,butalsothebackground.Section17.6.2cell, row, row group, column, and column group backgrounds, letting thecollapsingbordersmodelIntable background show through.
To remove ambiguity about the sentence afterposition of backgrounds on rows and
column, the question,following paragraph was added "and padding-left i and padding-right i refer toafter point 6:
the
left(resp.,right)paddingedges ofcelli."Section18.2Forthe'ButtonHighlight'value,changedrows, columns, row groups and column groups in thedescriptionfrom"Darkshadow"to"Highlightcolor".SectionA.3collapsing borders model coincide with theparentheticalphrase"somewhatanalogoustohypothetical grid lines on which the'display'property"wasmisleading.borders of the'speak'propertyresembles'visibility'insomewaysand'display'inothers.AppendixG.2LexicalscannerRemovedcells are centered. (And thus, in this model, thefollowinglinefromrows together exactly cover thescannerasitdoesnotappeartable, leaving no gaps; ditto for the columns.) In thegrammar:"@"{ident}{returnATKEYWORD;}separated borders model, theDIMENtokenisinedges coincide with thescannertoensurethatanumberfollowedbyanidentifierisreadasonetokenratherthantwo.Thiscaseisconsideredanerrorborder edges of cells. (And thus, inCSS2.AppendixE.Referencesthis model, there may be gaps between theentryfor"[URI]"referredrows and columns, corresponding toadraftthathasbecomeanRFC.theentryhasbeenchanged.C.1.3Changes'border-spacing' property.)
At the end of the section
6.4.3 Calculating a selector's specificityadded the "style" attribute nowfollowing paragraph:
Note that if the table has
ahigherspecificitythananystylerule.Section6.4.4Precedence'border-collapse: separate', the background ofnon-CSSpresentationalhintsIfpresentationalhintsfromothersourcesthanCSSaretakenintoaccountthe area given byaUA,itmusttreatthemashavingthesameweightas'border-spacing' property is always theuseragent'sdefaultstylesheet.Chapter9Visualformattingmodelbackground of thevalue'compact'for'display'doesnotexistinCSS 2.1.'Inline-block'isadded.table element. See 17.6.1
Added the width offollowing paragraph after the contents (using an algorithm similar toinitial paragraph of this
section:
Note that
fortablecells)andthen'right'(or'left')issolved.CSS2incorrectlysaidthis section overrides the rules that'right'(or'left')wassetapply to0calculating widths as described inthatcase,andthenwidthwassolved.section10.6.4Absolutelypositioned,non-replacedelementsLikenormal-flowblock-levelelements,absolutelypositionedelementsbydefaulttakeon10.3. In particular, if theheightmargins oftheircontents("shrink-wrap").If'height'and'bottom'a table arebothset to '0' and the width to 'auto', thecomputedvalueof'height'issettable will not automatically size to fill its containing block. However, once theheightcalculated value of 'width' for thecontentsandthen'bottom'table issolved.CSS2incorrectlysaidfound (using thereverse:'bottom'wassetto0andalgorithms given below or, when appropriate, some other UA dependant algorithm) thenheightwassolved.Section11.1.2WhileCSS2specifiedthatvaluesof"rect()"giveoffsetsfromtherespectivesidesother parts ofthebox,currentimplementationsinterpretvalueswithrespecttothetopandsection 10.3 do apply. Therefore a table can be centered using leftedgesforallfourvalues(top,right,bottom,andleft).Thisisnowright 'auto' margins, for instance.
The correct interpretation. 17.4.1 Caption position and alignmentWG may introduce ways of automatically making tables fit their
containing blocks in CSS3.
Added clarification about alignment of 'separate' rather than 'collapse' or exhibit behavior that is close to that value, even if they do not actually implementrow/column backgrounds. The
CSS table model. 'Separate'sentence "This space is now the initial value. Chapter 12 Generated content, automatic numbering, and lists Named counters don't exist in CSS 2.1, nor doesfilled with the 'marker' value for 'display'. Section 12.2background of the 'content' propertytable
element" was replaced by:
In this space, thevalues'<uri>'row, column, row group, and<counter>column group backgrounds aredropped.Chapter15Fontsinvisible, allowing the'font-stretch'and'font-size-adjust'propertiesdon'texisttable background to show through.
The 'empty-cells' property not only controls the borders, but also the background.
In CSS 2.1. Font descriptorsthe sentence after the question, added "and
padding-lefti and padding-righti refer
to the '@font-face' declaration don't exist in CSS 2.1.left (resp., right) padding of cell i."
For the 'cursor' property'ButtonHighlight' value, changed the value '<uri>' is dropped.description
from "Dark shadow" to "Highlight color".
The value 'progress' is added. Chapter 16 Textparenthetical phrase "somewhat analogous to the 'text-shadow''display' property"
was misleading. The 'speak' property is notresembles 'visibility' in
CSS 2.1. Appendix A. Aural style sheets Chapter 19 on aural style sheets has become appendix Asome ways and is not normative'display' in CSS 2.1. Related units (deg, grad, rad, ms, s, Hz, kHz) are also moved to this appendix, as isothers.
Removed the 'speak-header' propertyfollowing line from the "tables" chapter. Page breaks Onlyscanner as it
does not appear in the 'page-break-before', 'page-break-after' and 'page-break-inside' properties aregrammar:
"@"{ident} {return ATKEYWORD;}
The DIMEN token is in CSS 2.1. Otherthe former informativescanner to ensure that a number followed
by an identifier is read as one token rather than two. This case
is considered an error in CSS2.
The entry for fonts," is left out of CSS 2.1."[URI]" referred to a draft that has become an RFC.
The entry has been changed.