Contents
This appendix is informative, not exist innormative.
CSS 2.1 C.2.14 Chapter 13 Paged mediais an updated revision of CSS2. The 'size', 'marks'changes between the
CSS2 specification (see [CSS2]) and 'page' propertiesthis specification fall into
five groups: known errors, typographical errors, clarifications,
changes and additions. Typographical errors are not in CSS 2.1. C.2.15 Chapter 15 Fonts 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. C.2.16listed here.
This chapter 16 Text The 'text-shadow' propertyis not in CSS 2.1. C.2.17 Appendix A. Aural style sheets Chapter 19 on aural style sheets has become appendixa complete list of changes. Minor editorial
changes and is not normative in CSS 2.1. Related units (deg, grad, rad, ms, s, Hz, kHz)most changes to examples are also moved to this appendix, as is the 'speak-header'not listed here.
New color value: 'orange'
New 'display' value: 'inline-block'
New 'speech' media type is expected'content' values 'none' and 'normal'. (The values 'none' and
'normal' are equivalent in CSS 2.1, but may have different
functions in CSS3.)
New 'white-space' values: 'pre-wrap' and performance notes for fonts," is left out of CSS 2.1. C.3 Errors C.3.1 Shorthand properties Shorthand properties take a list of subproperty values or'pre-line'
New 'cursor' value: 'progress'
This new section is added to specifyexplain the subpropertymotivation for CSS2.1
and its relation to which 'inherit' applied.CSS2.
This rule: 'border-top', 'border-right', 'border-bottom', 'border-left', 'border', 'background', 'font', 'list-style', 'cue', and 'outline'. C.3.2section 4.1.1 (and G2 ) The "nmchar" token also allows(formerly Section 1.1) has been marked non-normative.
This section (formerly Section 1.2) has been marked non-normative.
This section (formerly unnumbered under 1.3.2) notes that value types are specified in terms of tokens and that spaces may appear between tokens in values. A note explains that spaces are required between some tokens.
This section (formerly unnumbered under 1.3.2) now declares the ruleMedia line
in property definitions to be non-normative.
A new line is added to each property definition specifying what the computed
values are for "any" (inthe core syntax),property. (This defines what level of computation is done to
a property value before inheritance and before certain other calculations.)
This section (formerly 1.3.4) now specifies that HTML examples lacking DOCTYPE declarations are SGML Text Entities conforming to the HTML 4.01 Strict DTD [HTML4]. The markup for many examples has been reformulated to either include a DOCTYPE or conform to this definition.
This section (formerly 1.4) has been updated to reflect contributions to CSS2.1 and has been marked non-normative.
Support for user style sheets is now required (in most cases), rather than just recommended.
Support for turning of author style sheets is now required.
Application of CSS properties to form controls is explicitly undefined. Authors are recommended to treat form control styling capabilities in UAs as experimental.
This section changed "FUNCTION"to "FUNCTION any* ')'".say that error handling is specified
in most cases.
Added INVALID token and rules for its definition.
An optional hyphen, "-", is now allowed at the beginning of an "ident" for vendor extensions. (See section 4.1.2.1)
The underscore character
("_") is allowed in identifiers. The definitions of the lexical
macros "nmstart" and "nmchar" now include it. C.3.3See also section
4.1.2.1 (Vendor extensions).
The "escape" macro has been modified to allow the escaping of any character except newlines, form feeds, and hex digits (to avoid conflict with unicode escapes).
Modified "string1" and "string2" macros by defining allowed characters through excluding disallowed characters. This allows invisible ASCII characters to be included in a string.
Updated prose about identifiers (second bullet point) to match changes
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) astokenization (above).
Excluded null (0x0) character from CSS numerical escapes and indicate that
it is undefined in CSS2.1 what happens if such a single whitespace character." The underscorecharacter is encountered.
Allowed in identifiers. Changed "In CSS2, identifiers [...] can contain onlythe use of U+FFFD as a replacement for characters [A-Za-z0-9] and ISO 10646 characters 161 and higher, plusoutside the
hyphen (-)" to:range allowed by Unicode.
Defined parsing in CSS2, identifiers [...] contain onlythe characters [A-Za-z0-9] and ISO 10646 characters 161 and higher, plus the hyphen (-)cases of Malformed Declarations,
Unexpected End of Stylesheet, and the underscore (_) C.3.4Unexpected End of String.
described in subsections of this section incorrectly allowed two "+" or "-" signs at their beginnings. C.3.5Sections 4.3.7 (Angles), 4.3.8 (Times), and 4.3.9 (Frequencies)
have been moved to the informative Appendix A.
The suggested reference pixel is based onAdded a 96 dpi device, not 90 dpi.paragraph on heuristics for finding the visual angle is thus about 0.0213 degrees insteadx-height of 0.0227, anda pixel at arm's length is about 0.26 mm instead of 0.28 C.3.6font.
Updated URI references to RFC3986.
Defined the document in some cases. C.3.8 8.2 Examplenumeric values corresponding to color keywords instead
of margins, padding, and borders Thereferencing HTML4 for those values.
UAs are now allowed to intelligently map colors inoutside the example HTML did not matchgamut
into the colors ingamut instead of simply clipping them into the image. C.3.9 Section 8.5.2 Border color: 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', and 'border-color'range of 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 C.3.10gamut.
Added this section 8.4 Padding properties The five properties relatedto padding ('padding', 'padding-top', 'padding-right', 'padding-bottom', and 'padding-left') now sayrecommend that they don't apply to table rows, row groups, header groups, footer groups, columns,unsupported properties and column groups. C.3.11 8.5.3 Bordervalues
be ignored as if they were invalid.
Changed the sentence "The color of borders drawncharacter encoding detection rule 2 to include a BOM and
referred to additional rules below.
Added rule 4 to provide for valuesuse of 'groove', 'ridge', 'inset', and 'outset' depends onthe element's 'color' property"referring style sheet
or document's character encoding.
Added rule 5 to require falling back to UTF-8.
Removed the color of borders drawnrestriction on using @charset in embedded style sheets.
Allowed a BOM to precede the @charset rule.
Added requirement that @charset rule must be a literal '@charset"...";', not a CSS-syntax equivalent.
Added requirement to support for valuesUTF-8 at minimum.
Specified that any @charset rule not at the beginning of 'groove', 'ridge', 'inset', and 'outset' shouldthe style sheet
must be ignored.
Removed note on theoretical problem with @charset problem and precisely
defined rules for character encoding detection based on the element's 'border-color' property, but@charset and/or BOM.
Specified that UAs may choose their own algorithm to calculate the actual colors used.must ignore style sheets in unknown encodings.
RFC 3066 replaces RFC 1766.
Class selectors are allowed for instance, ifother formats than HTML.
Added a note about matching classes in formats with multiple class
attributes per element. The 'border-color' hasbehavior is non-normative, because, at the
value 'silver', then a UA could use a gradienttime of colors from white to dark graywriting, there exist no such formats.
Specified how to indicate a sloping border. C.3.12match elements with two or more ID attributes.
Removed exception for HTML UAs that allowed them (and only them) to
<border-width> asignore ':first-letter' and ':first-line'.
UAs may return a :visited link to <border-style>. The value 'transparent':link status at some point. (This
was previously a note, but 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 C.3.13 8.5.4 Border shorthand properties: 'border-top', 'border-bottom', 'border-right', 'border-left',now normative.)
Added a note about privacy concerns with link pseudo classes and
'border' Changed <'border-top-width'>allowed UAs to <border-width>treat :visited 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>. C.3.14:link.
The properties 'top', 'right', 'bottom', and 'left' doidentifier C in ':lang(C)' need not apply. C.3.15be a valid language code,
but it must not be empty.
':first-line' also applies to inline blocks, table captions and
table cells. Added a box's content edge.definition of "first formatted line" to make the
proper edgerules about which line is the margin edge. Thus, for 'top',first line more precise.
UAs are no longer forbidden from applying more properties than the
description now reads: "This property specifies how far a box's top margin edge is offset belowgiven list.
More precise definition of first letter. Added rules for cases
where the box's containing block." C.3.16 Section 9.4.3first letter is in an inline block or table cell. Added
rules for cases when preceding punctuation is in a different element
from the first sentence,letter itself.
UAs may apply other properties to first letters than the given list.
Unicode character classes Pi and Pf added to the enddefinition of
"Once a box has been laidpunctuation.
Redefined "computed value" and created the concept of "used value"
so that inheritance can be performed without laying out according tothe normal flow"document.
This change has the words "or floated,". C.3.17 Section 9.7 Relationships between 'display', 'position',effect of allowing (requiring) percentages to be inherited
as percentages and 'float' If an element floats,affects many other layout calculations throughout the 'display'spec.
Since computed value of a property is set tocan now also be a block-level value, but not necessarily 'block'.percentage. In
bullet 3, changed "Otherwise,particular, the following properties now inherit the percentage if 'float' has athe
specified value other than 'none', 'display'is set to 'block' anda percentage:
Note that only 'text-indent' inherits by default, the boxothers only
inherit if the 'inherit' keyword is floated"specified.
Changed suggestion that user be able to turn off author styles to a table with the proper computed values. C.3.18requirement.
The computed value. to: If 'width'"style" attribute now has a specified value of 'auto' and 'height' also hashigher specificity than any style
rule.
Pseudo-elements are now counted with elements in calculating a
specified valuea selector's specificity.
"Non-CSS presentational hints" no longer exist, with the computed valueexception
of 'width'. If 'width' hasa specified valuesmall set of 'auto'attributes in HTML.
Added 'speech' media type.
Marked "Media" field in property descriptions informative.
Marked this section informative.
Added sound to 'handheld' in media type/media group table.
Changed 'tactile' to be both 'static' and 'height' has some other specified value,'interactive'.
If the containing block's width depends on an element with percentage
margins, then the computed value of 'width'resulting layout is (intrinsic width) * ( (computed height) / (intrinsic height) ). C.3.19 Section 10.3.3undefined in CSS 2.1.
In the last sentence of the paragraph following the equation ("If the valuedefinition of 'direction' is 'ltr', this happens"collapsing margins", added "non-empty content"
and "clearance" to 'margin-left' instead") substituted 'rtl' for 'ltr'. C.3.20 Section 10.6.2 Inline, replaced elements ... (and 10.6.5) Changed: If 'height' is 'auto', the computed value isthe intrinsic height. to: If 'height' has a specified valueparenthetical list of 'auto'things that prevent consecutive
margins from being adjoining.
Vertical margins of elements with 'overflow' other than 'visible' no longer collapse with their in-flow children.
Defined how margins collapse through an element with adjoining top and
'width' also has a specified valuebottom margins.
Added that margins of 'auto',the root element's intrinsic height is the computed value of 'height'.box do not collapse.
More rigorously defined "adjoining" for margin collapsing.
If 'height' has a specified value of 'auto' and 'width' has some other specified value,the containing block's width depends on an element with percentage
padding, then the computed value of 'height'resulting layout is (intrinsic height) * ( (computed width) / (intrinsic width) ). C.3.21undefined in CSS 2.1.
'transparent' can now be specified independently for each border side, on par with <color>.
3D border styles ('groove', 'ridge', 'inset', 'outset') now depend on the
height calculationcorresponding border-color rather than on 'color'.
Added this new section to the presencespecify layout of a padding or border. C.3.22inline boxes when affected by bidi.
Removed paragraphs about the first style rule appliedinitial containing block, as this is
now defined differently. (See changes
to both DIVs, so the second DIV box should have been rendered withsection 10.1.)
Added a red border as well. The second DIV has now been changedparagraph to define formatting when an inline box contains
a CITE, which doesn't have a red border. C.3.23 11.2 Visibility: the 'visibility'block box.
Specified what property values are applied to anonymous boxes.
Specified that collapsed whitespace does not generate anonymous inline boxes.
Changed "initial"run-in rules so that a) run-ins that contain blocks become blocks
b) run-ins can only run into sibling blocks and "inherited" to: Initial: visible Inherited: yes This hasc) run-ins cannot run into
other run-ins.
The original definition, but removes'marker' and 'compact' values of the undefined state'display' property are
not part of CSS 2.1. Text relating to these values has been
removed throughout the root element (which was a problemspecification.
Defined the computed value of 'display' as the specified value
except for positioned and floating elements and for DOM implementations). C.3.24 12.6.2 Lists Underthe 'list-style' property,root element.
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 childcomputed value of another UL element). An LI has been inserted'display' for these elements is defined in
between. C.3.25section 15.5 In bullet 2, changed "the UA uses the 'font-family' descriptor" to "the UA uses9.7 and is slightly
different from the 'font-family' property".definition in bullet 6, changed "steps 3, 4 and 5"CSS2.
Conforming HTML UAs are no longer allowed to "steps 2, 3, 4 and 5". C.3.26 Section 16.6 Whitespace:ignore the 'white-space' property'display'
property.
The 'white-space''position' property now applies to all elements, not just block-level elements. C.3.27 Section 17.2 The CSS table model Inincluding
generated content.
The definitioneffect of table-header-group , changed "footer" to "header" in "Print user agents may repeat footer rowsrelative positioning on each page spanned by a table." C.3.28 17.2.1 Anonymous table objects Moved the first bullet text to the prose before the list of generation rules and added missing rules. C.3.29 17.5 Visual layout of table contents The following note: Note.table cells may be relatively and absolutely positioned, but this is not recommended: positioningcaptions and floating remove a box from the flow, affecting table alignment. has been amended as follows: Note.internal
table cells may be positioned, but thiselements is not recommended: absolute andundefined in CSS 2.1.
For fixed positioning, as well as floating, removeintroduced a boxconflict between this section
and section 10.1 rule 3.
See howcome
for rationale.
Forbid UAs from paginating the flow, affecting table size. C.3.30 17.5 Visual layoutcontent of table contents Changed: Like other elementsfixed boxes.
UAs are allowed to treat all values of 'position' as 'static' on
the document language, internal table elements generate rectangular boxes with content, padding, and borders. They do not have margins, however. to: Like other elementsroot element.
Defined computed values of 'top', 'right', 'bottom', 'left' based
on 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. C.3.31value of 'position'.
Percentage offsets are no longer undefined for containing blocks without an explicit height.
Specified that floats, absolutely positioned elements, inline-blocks,
table-cells, table-captions, and columns only cover the whole tableelements with 'overflow' other than
'visible' establish new block formatting contexts.
In the collapsed borders model, not in the separated borders model. The points 2, 3, 4 and 5 have been corrected to defineparagraph about the area covered by rows, columns, row groups and column groups in termsposition of the cellsa box's outer edge with respect
to its containing block, except boxes that establish a new block formatting
context, as they cover. C.3.32 Section 17.6.1 The separated borders model In the image, changed "cell-spacing"may become narrower due to "border-spacing". C.3.33 Appendix D.2 Lexical scannerfloats.
Specified that the underscore character ("_") is be allowed in identifiers.effect of 'justify' on the definitionscontent of a line box
does not affect the lexical macros "nmstart"contents of inline-table and "nmchar" have been fixed. Note that the tokenizer is case-insensitive, so uppercase A-Z is matchedinline-block boxes.
Empty line boxes are now required to be treated as well. (Same changezero-height and
ignored in margin collapsing.
Added several paragraphs and an example to explain exactly what the
first linecomputed values of relatively-positioned offsets are, how they affect
each other, and what happens when 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"?> C.4.2 Section 4.1.1 DELIM shouldpositioning is overconstrained.
(These were not have included single or double quote. Refer alsopreviously defined.)
Floats are no longer required to section 4.1.6 on strings, which musthave matching single or double quotes around them. C.4.3 Section 5.5 Near the endan explicit width.
Floats outside of line boxes no longer align to the section, the text 'Note the whitespace on either sidebottom of
the "*"' was misleading. The note was not meant to imply that whitespacepreceding block box; it is required on both sides of the "*" (since the grammar does not requireimplied that they are initially
aligned with their non-floated position.
Specified that "If a shortened line box is too small to contain any
further content, then it in this case) butis shifted downward until either it fits or
there are no more floats present."
Specified that one may use whitespacethe border box of a table, block-level replaced element,
or element in this case. C.4.4 Section 5.9 ID selectorsthe word "precedence"normal flow that establishes a new block formatting
context must not overlap any floats in the last but one paragraph should have been "specificity." C.4.5same block formatting context.
The end'float' property now also applies to :before/:after and generated
content.
UAs are now allowed to treat all values of float as 'none' on the
section about the fictional tag sequence inroot element.
Added to rule 4 prose to define the caseposition of nested block-level elements C.4.6a float when it
occurs between two collapsing margins.
Defined clearance to precisely detail the 'inherit' value causes'clear' property's
effect on margin collapsing and the properties value to be inherited. This applies evenblock's cleared position.
Added note to properties for which values doexplain effect of 'clear' on inline elements since
CSS1 (but not otherwise inherit. C.4.7 6.4 The CascadeCSS2 or CSS 2.1) allows 'clear' on inline elements.
Changed "Rules specified in a given style sheet overriderules imported from other style sheets."to "Rules specified in aconvert 'display' not always to 'block', but
to an appropriate block-level display value as given style sheet override rules of the same weight imported from other style sheets." C.4.8 Section 6.4.3 Calculatingby a selector's specificitymapping
table.
Added a note:rule 4 to convert root element's 'display' value according
to the specificity is based only onmapping.
Specified that the formbackground and borders of the selector. In particular,an element that forms
a selectorstacking context are behind all of the form " [id=p33] " is counted as an attribute selector (a=0, b=1, c=0),its descendants, altered stacking
context prose to be more precise, and added a normative
Appendix E: Elaborate description of Stacking
Contexts to be even ifmore precise about the id attribute is defined as an "ID" inposition of borders,
backgrounds, and content on the source document's DTD. C.4.9z-axis.
Conforming UAs are now allowed to clarifynot support bidirectional text; in
this case they must ignore the 'direction' and 'unicode-bidi' properties.
However since applying bidi can have an effect even when a document
doesn't contain right-to-left characters, UAs that media typesdo support bidi are
mutually exclusive. C.4.10 Section 8.1 Fromno longer permitted to not apply the definition of "padding edge", deletedalgorithm just because the sentence "The padding edge ofdocument
lacks right-to-left characters.
Added a box definesparagraph to define precisely how the edgesUnicode bidirectional
algorithm applies to text in the CSS formatting model and how the CSS
'direction' property on blocks maps into the algorithm.
Conforming HTML UAs are no longer exempt from supporting 'direction' and 'unicode-bidi'.
Updated prose to use the terms "specified", "computed" and "used" as appropriate when referencing values. This affects many calculations in this section. (See changes to section 6.1.)
In rule 1, defined the initial
containing block established byas the box."viewport for information about containing blocks, consult Section 10.1 . Border backgrounds are not specified by border properties. Changedcontinuous media and the last paragraph of 8.1 to:page
area for paged media. (It was previously undefined.)
In rule 2, defined the background style ofpage area as the content, padding, and border areascontaining block for fixed
positioned elements in paged media.
In rule 4.1, when the containing block of a boxan absolutely-positioned
element is specifiedformed by an inline-level element, it is now formed by that
element's padding edges, not its content edges.
In rule 4, changed the 'background' property ofcontaining block for absolutely positioned
elements with only statically positioned elements from the generating element. Margin backgrounds are always transparent. C.4.11 Section 8.3.1 Added this clarifying noteroot's
content box to the first bullet ofinitial containing block.
Specified the explanation of vertical collapsingpositioning and breaking behavior of margins: Note. Adjoining boxes may be generated byabsolutely-positioned
elements that are not related as siblings or ancestors. C.4.12in paged media.
Declared that if the statement "Whencontaining block's width depends on an inline boxelement's
percentage width, then the resulting layout is split, margins, borders,undefined in CSS 2.1.
The split occurs." has been generalized. Margins, borders,computed values of 'left' and padding have no visual effect where one or more splits occur. C.4.13'right' for are now defined in
section 9.4.3 Relatively positioned boxes do9.3.2. The value
'auto' does not always establish new containing blocks. Changed the second paragraph accordingly.compute to zero.
Added clarifying text and an example about the 'left', 'right', 'top'sections 10.3.9 and 'bottom' properties10.3.10 to define calculations for relative positioning. C.4.14inline blocks.
The last paragraph: Conforming HTML user agents may therefore ignoresizing algorithm for replaced elements now takes into account and
attempts to preserve the 'direction'replaced content's intrinsic ratio. Sizing of
replaced elements with percentage intrinsic sizes and 'unicode-bidi' propertieswithout intrinsic
sizes is now also defined.
Added the word "ignore" meantvertical scrollbar width to the horizontal constraint equation.
Specified that ifa 'unicode-bidi' or 'direction' value conflicts withcomputed total of the HTML 4 "dir" attribute value, then user agents may choose to use the "dir" value ratherwidth, padding, and borders
that is greater than the CSS properties. User agents are not required to support the 'direction' and 'unicode-bidi' properties to conformcontaining block width causes auto margins to
CSS2 unless they support bi-directional text rendering (except forbe treated as zero in the caserest of HTML 4 as noted above).the sentence has been rewritten to be clearer. C.4.15 10.3.3rules. This avoids 'auto' margins
being negative on the start edge.
Added the following note at the end of the section: Note that 'width' may not be greater than 'max-width'Applied changes to section 10.3.2 and not less than 'min-width'.section 10.3.3 to block-level
replaced elements in particular, it may not be negative. Seenormal flow by referring to the rulescalculations in
those sections.
Defined computations for 'auto' width floats as shrink-to-fit. (Floats were previously required to have fixed widths.)
Applied changes to chose the containing blocksection 10.3.2 to this section by referencing
it for 'auto' width calculations.
Defined the rootstatic position of an element (see 10.1), therefore this sentence has beenmore precisely.
Added as a suggestion: A UA may compute a percentage height on the root element relativevertical scrollbar width to the viewport. C.4.17horizontal restraint equation.
Rewrote constraint rules.
have a 'font-size'In rule 1, applied sizing rules from section 10.3.2.
In rule 2 (formerly rules 2 and a 'line-height' property, even if they are not used directly3), referred to determine the heightnew definition of
the box. The 'font-size' is, however, used to define the 'em' and 'ex' units, and the 'line-height' has a role'static position' in the 'vertical-align' property. as follows: Note that replaced elements have a 'font-size'section 10.3.7.
In rule 4 (formerly rule 5), prevented 'auto' left and right margins
in resulting in a 'line-height' property, evennegative margin on the start edge.
Specified that if they are not used directly to determinethe height ofcontaining block's width is negative, the
box: 'em' and 'ex' values are relative to valuesused value of 'font-size' anda percentage values for 'vertical-align' are relative to values of 'line-height' . Under 'line-height', after the sentence "If the propertymin/max width is set on a block-level element whose contentzero.
Specified that if the min/max width is composed of inline-level elements, it specifiesspecified in percentages and
the minimal height of each generated inline box," addedcontaining block's width depends on this element's width, then the
following clarification:resulting layout is undefined in CSS 2.1.
The UA is no longer allowed to select an aribtrary minimum height consist of a minimum height abovewidth.
The block's baselineused width of replaced elements with an intrinsic ratio and a minimum depth below it, exactlyboth
'width' and 'height' specified as if each line box starts with'auto' is now calculated according to
a zero-widthtable designed to preserve the intrinsic ratio as much as possible
within the given constraints.
Removed mention of 'line-height' for inline elements since their
content box with the block's font and lineheight properties (what T E X calls a "strut"). C.4.18 Section 11.1 Clarifications to the last two bulletsno longer depends on 'line-height'.
Percentage heights on absolutely-positioned elements are no longer
treated as 'auto' when overflow may occur: A descendent box is positioned absolutely partly outside ofthe box.containing block's height is not explicitly
specified. Added a descendent box has negative margins, causing itnote to be positioned partly outside the box. C.4.19 Section 11.1.1 Removed 'projection' from this sentence under the value 'scroll' Whenexplain why this valueis possible.
Specified andthat a percentage height on the target mediumroot element is 'print' or 'projection', overflowing content should be printed. C.4.20relative
to the initial containing block.
The definitioncomputed values of <shape>'top' and 'bottom' for are now starts:defined in
CSS2,section 9.3.2. The only valid <shape>value
is: rect (<top>, <right>, <bottom>, <left>) ... Due'auto' does not always compute to this ambiguity, user agents may support separation of offsets in "rect()" with or without commas. C.4.21 12.1 The :before and :after pseudo-elements Clarificationzero.
Added section 10.6.6 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 valuescover cases that are 'none', 'inline' and 'block'. If the value ofno longer covered under
the pseudo-element's 'display' property has anyprevious sections.
Added section 10.6.7 to define 'auto' heights for block formatting
context roots. (Unlike other value, the pseudo-element will behave as if its value were 'block'. Ifblock boxes, the subjectheight of these boxes
increases to accomodate any normal-flow descendant floats.)
The selector is an inline-level element, allowed values are 'none' and 'inline'. If the valueheight of an inline box is no longer given by the pseudo-element's 'display''line-height'
property has any other value, the pseudo-element will behave as if its value were 'inline'. C.4.22and is now undefined. This section 12.4.2 Inserting quotes with the 'content' property Added the following sentence atnow suggests that the
endheight of the 2nd paragraph: A 'close-quote' that would makebox can be based on the depth negative isfont.
The depth stays at 0sizing algorithm for replaced elements now takes into account and
no quote mark is rendered (althoughattempts to preserve the restreplaced content's intrinsic ratio. Sizing of
the 'content' property's valuereplaced elements with percentage intrinsic sizes and without intrinsic
sizes is still inserted). C.4.23 14.2 The background Second sentence: "In terms ofnow also defined.
Specified that for inline elements, the margin box model, 'background' refers tois used when calculating
the backgroundheight of the content and the padding areas" now also mentions the border area. (See also errata toline box.
This section now only applies to elements whose 'overflow' value computes
to 'visible'; elements with other values of the content, padding and border areas.'overflow' are discussed in the
fourth paragraph, added tonew section 10.6.7 ('Auto' heights for block formatting context roots).
Defined the endstatic position of "User agents should observe the following precedence rulesan element more precisely.
Added vertical scrollbar width to fill in the background" the following words: "ofthe canvas". C.4.24 14.2.1 Background properties Added this note afterhorizontal restraint equation.
Rewrote constraint rules.
In rule 1, applied sizing rules from section 10.6.2.
Percentage min/max heights on absolutely-positioned elements are no
longer treated as '0'/'none' when the first paragraph after 'background-attachment': Note that therecontaining block's height is only one viewport per document. I.e., evennot
explicitly specified. However if the containing block's width depends
on an element has a scrolling mechanism (see 'overflow'), a 'fixed' background doesn't move with it. Under 'background-repeat',element's percentage width, then the sentence "All tiling coversresulting layout is undefined
in CSS 2.1.
The contentused width of replaced elements with an intrinsic ratio and padding areas [...]" has been corrected to "All tiling covers the content, paddingboth
'width' and border areas [...]". Under 'background-attachment', the sentence "Even if the image'height' specified as 'auto' is fixed [...] background or padding area of the element" has been correctednow calculated according to
Even if the image is fixed, it is still only visible when it is ina table designed to preserve the background, padding or border area ofintrinsic ratio as much as possible
within the element. C.4.25given constraints.
Added to:rule 4 to specify that the valueheight of 'text-indent' may be negative, but there maythe line box must be implementation-specific limits.at
least as much as that specified by the following clarification: "If'line-height' property on the
valuethis block.
UAs are no longer permitted to clip content to the line box, and are instead asked to render overlapping boxes in document order.
'line-height' set on a block no longer specifies the minimal height
of 'text-indent' is negative,each inline box; instead it specifies the valueminimal height of 'overflow' will affect whethereach
line box. The textexact effect of this requirement is visible." C.4.26 16.2 Alignment: the 'text-align' property Changed "double justify" to "justify" under "left, right, center, and justify". C.4.27 Section 17.5.1 Table layers and transparencyexpressed in point 6, changed 'These "empty" cells are transparent' to: Ifterms
of struts; it is affected by vertical-alignment.
Adjusted text to reflect that the valuecontent box height of their 'empty-cells' propertyan inline
is 'hide' these "empty" cells are transparent throughno longer dictated by the cell, row, row group, column, and column group backgrounds, letting'line-height' property.
Since the table background show through. To remove ambiguity aboutcontent box is now defined by the position of backgrounds on rowsfont and column,not by the
following paragraph was added after point 6:line-height, 'text-top' and 'text-bottom' refer to the edgescontent area
instead of the rows, columns, row groupsfont.
Defined 'top' and column groups'bottom' alignment in terms of aligned subtrees
to take into account any protruding descendants.
Defined the collapsing borders model coincide with the hypothetical grid lines on which the bordersbaseline of inline tables and inline blocks.
Specified that 'overflow' clips to the cellspadding edge.
'projection' media are centered. (And thus, in this model, the rows together exactly cover the table, leavingno gaps; dittolonger permitted to print overflowing
content for the columns.) In the separated borders model, the edges coincide with the border edges of cells. (And thus, in this model, there'overflow: scroll'. 'print' media now may be gaps between the rows and columns, corresponding, as
opposed to should.
UAs are now required to apply the 'border-spacing' property.) At the end of the section added'overflow' property set on the following paragraph: Note that ifroot
element to the table has 'border-collapse: separate',viewport. Additionally, HTML UAs must use the background of'overflow'
property on the area given byHTML BODY element instead if the 'border-spacing' propertyroot element's
'overflow' value is always the background'visible'.
Specified placement of scrollbar in the table element. See 17.6.1 C.4.28box model.
The rules that apply'clip' property now applies only to calculating widths as described in section 10.3 . In particular, if the margins of a table are setabsolutely positioned elements.
Furthermore, it applies to '0' andthose elements even when their 'overflow' is
'visible'.
The width todefault value of 'clip', 'auto', the table will not automatically sizenow indiciates no clipping
rather than clipping to fill its containing block. However, oncethe calculated valueelement's border box.
Values of 'width' for the table is found (using the algorithms given below or, when appropriate, some other UA dependant algorithm) then the other parts of section 10.3 do apply. Therefore a table can"rect()" should be centered using left and right 'auto' margins, for instance. The WGseparated by commas. UAs are
required to support this syntax, but may introduce waysalso support a space-separated
syntax since CSS2 was not clear about this.
While CSS2 specified that values of automatically making tables fit their containing blocks in CSS3. C.4.29 17.6.1"rect()" give offsets from the
separated borders model Added clarification about alignmentrespective sides of row/column backgrounds.the sentence "This space is filledbox, current implementations interpret values
with respect to the background of the table element" was replaced by: Intop and left edges for all four values
(top, right, bottom, and left). This space,is now the row, column, row group, and column group backgrounds are invisible, allowingspecified
interpretation.
The table background'visibility' property is now defined to show through. C.4.30 Borders around empty cells:inherit, and descendant
elements can override an ancestor's hidden visibility.
Moved all discussion of aural rendering to Appendix A.
Removed restrictions on which properties and property values are allowed on ':before' and ':after' pseudo-elements.
The initial value of 'content' is now 'normal', not only controlsthe borders, but alsoempty
string.
The background. C.4.31 Section 17.6.2'content' property now distinguishes between the collapsing borders modelempty string,
which creates an empty box; and 'normal'/'none', which create no box
at all. (There is no distinction between 'normal' and 'none' in
level 2.)
A UA is now allowed to report a URI that fails to download.
Removed recommendation to authors to put rules with media-sensitive 'content' properties inside '@media'.
Whether '\A' escapes in generated content create line breaks is now
subject to the sentence after'white-space' property.
The question, added "and padding-left iformer section 12.3 on interaction between ':before', ':after'
and padding-right i refer to the left (resp., right) paddingelements with 'display: compact' or 'display: run-in' has been
removed. (The interaction is already fully defined, because generated
content consists of cell i." C.4.32boxes in the tree, no different from other boxes.)
Specified that extra 'close-quote's and 'no-close-quote's (those
without a matching 'open-quote' or 'no-open-quote') are not rendered,
and that neither 'close-quote' nor 'no-close-quote' cause the description from "Dark shadow"quoting
depth to "Highlight color". C.4.33be negative.
Defined what a rule with duplicate counters, such as
'counter-reset: section A.32 section', means.
The parenthetical phrase "somewhat analogousscope of a counter no longer defaults to the 'display' property" was misleading.whole document,
but starts at the 'speak' property resembles 'visibility' in some ways and 'display' in others. C.4.34 Appendix G.2 Lexical scanner Removedfirst element that uses the following line fromcounter. (This affects
counters that are used without a prior 'counter-reset' to set the
scanner as it does not appearscope explicitly.)
Removed text in section 12.5 (formerly 12.6) relating to the
grammar: "@"{ident} {return ATKEYWORD;}'marker' display value.
Removed the DIMEN token is in'marker-offset' property (and thus former section 12.6.1).
The scannerlist styles 'hebrew', 'armenian', 'georgian', 'cjk-ideographs',
'hiragana', 'katakana', 'hiragana-iroha' and 'katakana-iroha' have
been removed due to ensure that a number followed by an identifier is read as one token rather than two. This case is considered an errorlack of implementation experience. (They are
expected to return in CSS2. C.4.35 Appendix E. Referencesthe entry for "[URI]" referred to a draftCSS3 Lists module.)
Removed the sentence that said that has becomean RFC.unknown value for
'list-style-type' should cause the value 'decimal' to be used instead.
Instead, normal parsing rules apply and cause the entryrule to be
ignored.
The 'size', 'marks', and 'page' properties are not part of CSS 2.1.
The requirement for UA's to honor different declarations for
:left, :right, and :first pages has been changed.softened to simplify
implementations: the page area of the :first page may be used
for :left and :right pages as well.
UAs are now only required to apply the page break properties to block-level elements in the normal flow of the root element, not to other blocks.However, UAs are now permitted to apply these properties to elements other than block-level elements.
Defined treatment of margins, borders, and padding when a page break splits a box.
When dropping restrictions to find a page breaking opportunity, rule A is dropped together with B and D rather than together with C.
Removed restriction on breaking within absolutely positioned boxes.
For 'background-position', the restriction that keywords cannot be combined with percentage or length values is removed. I.e., a value like: '25% top' is now allowed. Also, 'background-position' now applies to all elements, not just to block-level and replaced elements.
User agents are no longer allowed to treat a value of 'fixed' for 'background-attachment' as 'scroll'. Instead they must ignore all such declarations as if 'fixed' were an invalid value.
The contents of this section is now a non-normative note.
The 'font-stretch' and 'font-size-adjust' properties have been removed in CSS 2.1.
Font descriptors, the '@font-face' declaration, and all associated parts of the font matching algorithm have been removed in CSS 2.1.
In this section (previously 15.5), in step 5 (prevously 8) of the font matching algorith, the UA is now allowed to use multiple default fallback fonts to find a glyph for a given character.
In the per-property rule 2, specified that if there is only a small-caps font in a given family, then that font will be selected by 'normal'.
The "missing character" glyph is no longer considered a match for the last font in a font set, but is now considered a match for U+FFFD.
Certain punctuation characters when appearing in unquoted font family names are now required to be escaped.
The 'font-variant' property's effect is no longer restricted to bicameral scripts.
The computed value of 'font-weight' has been defined more precisely such that the 'bolder' and 'lighter' values have an appropriate effect when inheriting through elements with different font-families.
Removed suggestion of 1.2 fixed ratio between keyword font sizes in favor of notes recommending a variable ratio and a smallest font-size no less than 9 pixels per EM unit.
Added table mapping CSS font-size keywords to HTML font size numbers.
The 'text-shadow' property is not in CSS 2.1.
The initial value of 'text-align' is no longer UA-defined but a nameless value that acts as 'left' if 'direction' is 'ltr', 'right' if 'direction' is 'rtl'.
The <string> value for 'text-align' is not part of CSS 2.1.
For 'text-align', specified that 'justify' is treated as the initial value when computed value of 'white-space' is 'pre' or 'pre-line'.
More precisely defined what boxes are affected by text decorations specified on a given element.
Specified that underlines, overlines, and line-throughs apply only to text.
Specified that an underline, overline, or line-through applied across a line must be at a constant vertical position and with a constant thickness across the entire line.
Specified how text decorations are affected by relative positioning on descendants.
User agents are now allowed to recognize the 'blink' value but not blink, whereas before they were required to ignore the 'blink' value if they chose not to support blinking text.
Added text to allow older UAs to conform to this section if they follow CSS2's 'text-decoration' requirements but not the additional requirements in CSS2.1.
Support for the various values of 'letter-spacing' and 'word-spacing' is no longer optional.
Specified that word spacing affects each space, non-breaking space, and ideographic space left in the text after white space processing rules have been applied.
UAs are no longer allowed to not transform characters for which there is an appropriate transformation but which are outside of Latin-1.
The 'white-space' property now applies to all elements, not just to block-level elements.
"\A" in generated content no longer forces a break for 'normal' and 'nowrap' values of 'white-space'.
Specified that the CSS white space processing model assumes all newlines have been normalized to line feeds.
Added section 16.6.1 to precisely define white space handling.
Added section 16.6.3 to specify handling of control and combining characters.
Moved all discussion of aural rendering and related properties to Appendix A.
Updated prose to use the terms "specified", "computed" and "used" as appropriate when referencing values. (See changes to section 6.1.)
Defined handling of multiple 'table-header-group' and 'table-footer-group' elements.
UAs are no longer allowed to ignore the table display values on arbitrary HTML elements, only on HTML table elements.
Changed rules so that internal table elements without an enclosing 'table' or 'inline-table' box generate an anonymous 'inline-table' rather than an anonymous 'table' when inside a "display: inline" parent element.
The anonymous table object rules now treat anonymous boxes as equal to elements' boxes. Replaced several instances of the term "element" with "box", removed several instances of "(in the document tree)" and clarified that anonymous boxes generated in earlier rules are part of the input to later rules. Also replaced the term "object" with "box", as is used throughout the rest of the specification.
HTML UAs are no longer exempt from the anonymous box generation rules.
The relationship of the caption box, table box, and outer anonymous table box has been changed as follows:
The 'left' and 'right' values on 'caption-side' have been removed.
Changed rule 5 in grid layout rules to allow overlapping of table cells instead of leaving skipping a gap in the grid to avoid overlap.
In point 6, changed 'These "empty" cells are transparent' to:
If the value of their 'empty-cells' property is 'hide' these "empty" cells are transparent through the cell, row, row group, column, and column group backgrounds, letting the table background show through.
Specified that in fixed table layout, extra columns in rows after the first must not be rendered.
Restricted inputs to the table layout algorithm for 'table-layout: auto', whether or not the algorithm described in this section is used, to the width of the containing block and the content of, and any CSS properties set on, the table and any of its descendants.
Added rule 4 to include the column group's width in the algorithm for determining column widths.
The 'height' property on tables is now treated as a mininimum height; the UA no longer has the option of using 'height' to constrain the size of the table to be smaller than its contents.
Percentage heights on table cells, rows, and row groups now compute to 'auto'.
The baseline of a cell is now defined much more precisely.
Defined the baseline of a row with no baseline-aligned cells.
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.
Specified the effect of padding on the table element.
Specified which parts of the table are included in the width measurement.
Refined definition of "empty" when used as a condition for the 'empty-cells' property so that it is not triggered when the cell includes any child elements, even if they are empty.
The 'empty-cells' property now hides both borders and backgrounds, not just borders.
Changed behavior of a row when it collapses due to 'empty-cells': it is no longer treated as "display: none". Instead it is given zero height and its associated border-spacing is eliminated.
The outer half of the table borders no longer lie in the margin area. Specified which part of the table is considered the border are in the collapsed borders model and how its width is calculated. The edges of the box in which the table background is painted is, however left explicitly undefined.
Defined in rule 4 what happens when two elements of the same type conflict and their borders have the same width and style.
Position of outline with respect to the border edge is now only suggested, not required.
Conformant UAs are now allowed to ignore the 'invert' value. In such UAs the initial value of 'outline-color' is the value of the 'color' property.
The 'marker' value for 'display' does not exist 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 and other notes on aural table rendering. The 'aural' media type is deprecated in favor of the new 'speech' media type.
Changed the initial value of 'pause-before' and 'pause-after' to be 0 instead of UA-defined.
A note has been added to this section (formerly 19.4) about the change in position and behavior of pauses in CSS3 Speech compared to this appendix.
This section (formerly Section 19.5) now specifies the placement of cues and pauses with respect to the :before and :after pseudo-elements.
The keywords 'mix' and 'repeat' may now appear in either order.
Various references in Appendix B (formerly Appendix E) have been updated as appropriate.
Switched [CSS1] from Normative to Informative.
Updated URI reference from [RFC1808] and the draft-fielding-uri-syntax-01.txt to [RFC3986].
Updated HTTP reference from [RFC2068] to [RFC2616].
Removed normative references to [IANA] and [ICC32].
Added normative references to [ICC42], [RFC3986], [RFC2070], [UAAG10].
Added informative references to CSS2, CSS3 Color, CSS3 Lists, Selectors, CSS3 Speech, DOM 3 Core, MathML 2, P3P, RFC1630, SVG 1.1, XHTML 1, XML ID, and XML Namespaces.
Removed informative references to [ISO10179] (DSSSL), [INFINIFONT], [ISO9899] (C), [MONOTYPE], [NEGOT], [OPENTYPE], [PANOSE], [PANOSE2], [POSTSCRIPT], [RFC1866] (HTML 2), [RFC1942] (HTML Tables), [TRUETYPEGX], [W3CStyle].
Updated language tags references from [RFC1766] to [3066].
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 "applies to" line of many property definitions has been made more accurate by excluding or including table display types where appropriate.
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.
Removed "A-Z" from the "nmchar" token: as CSS is case insensitive anyway, it was redundant.
Corrected "unicode" macro to treat CRLF as a single character.
Corrected "block" production to allow white space between declarations.
In the rule for "any" (in the core syntax), corrected "FUNCTION" to "FUNCTION any* ')'".
Corrected third paragraph to say that an '@import' rule can only be preceeded by an '@charset' rule or other '@import' rules.
Several values described in subsections of this section incorrectly allowed two "+" or "-" signs at their beginnings.
Fixed double sign error in definition of <length>. (<number> already has a sign.)
Corrected the suggested reference pixel to be 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
Corrected last sentence to refer to a unsupported used length, not an unsupported specified length.
Fixed double sign error in definition of <percentage>. (<number> already has a sign.)
Defined escaping requirements in terms of the URI token so that no escaping requirements are missing from the prose.
Included invalid URIs in last paragraph about URI error handling.
Corrected syntax of counter() and counters() notation to allow white space between tokens.
Deleted the comments about range restriction after the following examples:
em { color: rgb(255,0,0) } em { color: rgb(100%, 0%, 0%) }
(Formerly section 4.3.10) Corrected text to allow all forms of Unicode escapes for U+000A, not just the "\A" form, for including newlines in strings.
In the second bullet, added that the ':lang()' pseudo-class can also be deduced from the document in some cases.
Removed paragraph about imported style sheets being overridden by rules in the importing style sheet: imported style rules follow the cascade as specified in 6.4.1 Cascading order, exactly as if they were inserted in place of the @import rule.
The definition of "content edge" has been changed to depend on 'width' and 'height' rather than directly on 'rendered content'.
From the definition of "padding edge", deleted the sentence "The padding edge of a box defines the edges of the containing block established by the box." For information about containing blocks, consult Section 10.1.
The colors in the example HTML did not match the colors in the image.
Changedvarious border shorthands' syntax definitions to use the <border-width>, <border-style> and <'border-top-color'> value types as appropriate.
Excepted table elements from second paragraph about principal block boxes and their contents.
Corrected sentence to say "either only block boxes or only inline boxes" instead of "only block boxes".
In the definition of "position: static", added 'right' and 'bottom' to the sentence saying that 'top' 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."
Corrected text under property definitions to say that for relatively-positioned elements, 'top', 'right', 'bottom', and 'left' define the offset from the box's position in the normal flow, not from the edges of the containing block. (The previous definition conflicted with that was further down; since that text is now redundant, it has been removed.)
In paragraph about relationship of a box's outer edges to its containing block's edges, corrected parenthetical to say that line boxes, not the content area, may shrink due to floats.
Added "and the presence of floats" to "The width of a line box is determined by a containing block".
In the first paragraph, added "or floated" to the phrase "laid out according to the normal flow" as floated elements can be relatively positioned but are not part of the normal flow.
Corrected sentence about not enough horizontal room for the float to say that it is shifted downward until either it fits or there are no more floats present.
Correct "Applies to" line and prose to say that the 'float' property can be set for any element but only applies to elements that are not absolutely positioned.
Removed sentence saying that 'clear' may only be specified for block-level elements: it can be specified for any element, it only applies to block-level elements.
Corrected sentence that said absolutely positioned boxes establish a new containing block for absolutely positioned descendants to except fixed positioned descendants.
In rule 1, corrected "user agents must ignore 'position' and 'float" to "'position' and 'float' do not apply".
Corrected note about 'direction' on table column elements to say that "columns are not the ancestors of the cells in the document tree" rather than saying "columns don't exist in the document tree".
Added table cells, table captions, and inline blocks alongside block-level elements in description of 'bidi-override' value. Also corrected the prose to handle anonymous child blocks.
Updated mention of Unicode's embedding limit from 15 to 61.
Included table cells (and inline blocks) together with block-level elements in rule 2 defining the containing block of non-absolutely-positioned elements.
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'.
The initial value for 'min-width' is now '0' rather than UA-dependent.
Corrected "applies to" exception for both 'min-width' and 'max-width' from "table elements" to "table rows and row groups".
Specified that negative values for 'min-width' and 'max-width' are illegal.
Added that 'auto' height also depends on whether the element has padding or borders, as these influence margin-collapsing behavior.
Added text to correctly account for margin collapsing behavior.
Corrected "applies to" exception for both 'min-width' and 'max-width' from "table elements" to "table columns and column groups".
Specified that negative values for 'min-height' and 'max-height' are illegal.
Corrected "applies to" line for 'overflow' from "block-level and replaced elements" to "non-replaced block-level elements, table cells, and inline-block elements".
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.
Corrected "rect (<top> <right> <bottom> <left>)" to "rect(<top>, <right>, <bottom>, <left>)".
Corrected initial value of 'visibility' to 'visible'.
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.
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.
Under 'background-image', defined the image tile size used when the background image has intrinsic sizes specified in percentages or no intrinsic size.
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 value 'scroll' is defined to scroll with the "containing block" rather than with the "document". Also 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.
In bullet 2, changed "the UA uses the 'font-family' descriptor" to "the UA uses the 'font-family' property".
The statement "Negative values are not allowed" for 'font-size' now applies to percentages as well as lengths.
Corrected 'text-indent' to apply to table cells (and inline blocks) as well as block-level elements.
Corrected 'text-align' to apply to table cells (and inline blocks) as well as block-level elements.
Changed prose about the effect of 'justify' to be less correct.
Corrected the note to say that justification is also dependent on the script, not just the language, of the text.
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."
Added 'table-header-group' and 'table-footer-group' alongside mentions of 'table-row-group' where missing.
Corrected 'caption' to 'table-caption'.
Added missing rule (#3) for 'table-column' boxes.
Added 'table-caption' and 'table-column-group' to list of boxes requiring a 'table' or 'inline-table' parent in rule 4.
Added rules 5 and 6 to generate 'table-row' boxes where necessary for children of 'table'/'inline-table' and 'table-row-group'/'table-header-group'/'table-footer-group' boxes.
Specified handling of multiple caption boxes.
Specified that the anonymous outer table box is a 'block' box if the table is block-level and an 'inline-block' box if the table is inline-level but that the anonymous outer table box cannot accept run-ins.
Correct text that said all internal table elements have padding; change to say that of these only table cells have padding.
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.
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 and thus the positioning and painting of backgrounds on those elements.
Specify the handling of "missing cells".
In the image, changed "cell-spacing" to "border-spacing".
For the 'ButtonHighlight' value, changed the description from "Dark shadow" to "Highlight color".
This section has been marked non-normative.
This section has been marked non-normative.
Added a statement about case-sensitivity of selectors for XML.
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"?>
Added a note to clarify that the deprecated/non-deprecated status of a feature is distinct from its normative/non-normative status.
Under 'document language' clarified that CSS only describes the presentation of a document language, and has no effect on its semantics.
Changed definition of 'replaced element' to "an element whose content is outside the scope of the CSS formatting model" and added further clarifying text. This clarifies that e.g. SVG images embedded in an XML document are also considered replaced elements, not just those linked in from an outside file. Also changed definition of 'rendered content' to be consistent with this clarification.
Added definition for 'ignore'.
Added definition for 'HTML user agent'.
Added definition for 'property'.
Moved definitions of "immediately before" and "immediately after" forward so they apply to the whole Syntax section.
Added sections 4.1.2.1 and 4.1.2.2 to defined vendor-specific extensions.
Clarified that input that cannot be parsed according to the core syntax is ignored according to the rules for handling parsing errors.
Clarified that input that cannot be tokenized or parsed has no meaning in CSS2.1.
Clarified that when a CRLF pair terminates an escape sequence, the pair is treated as a single whitespace character as corrected in the tokenization rules.
Replaced the term "{}-block" with "declaration block".
Clarified that all property:value combinations and @-keywords that do not contain an identifier beginning with dash or underscore are reserved by CSS for future use.
Clarified that when something inside an at-rule is ignored because it is invalid, this does not make the entire at-rule invalid.
Referenced section 4.1.7 for parsing invalid bits inside declaration blocks.
Clarified that '-0' is equivalent to '0' and is not a negative number.
Clarified that negative length values on properties that don't allow them cause the declaration to be ignored.
Reduced unnecessary discussion of what a URI is.
Added note about terminology change ("simple selector") between CSS2 and CSS3.
Clarified that text nodes and comments do not affect whether a sibling selector matches.
Clarified that rules about default attribute values are the same, whether the default is specified in a DTD or by other means.
Added a note that it depends on the document format which attributes are ID attributes.
Clarified that CSS 2.1 does not define if the parent of an element that matches ':active' or ':hover' itself also matches ':active' or ':hover'.
Added note that, in CSS1, ':active' only applies to links.
Added a note to show the differences between ':lang(xx)' and '[lang=xx]'.
Clarified that digits can also be first letter.
Clarified that computed values are inherited (not specified values) and that they become the specified value on the inheritor.
Removed discussion of "default" styles for a document.
Clarify that 'inherit' can be used on properties that are not normally inherited and that when set on the root element, it has the effect of assigning the property's initial value.
Except @charset from the statement that @imports must precede all other rules.
Obfuscated note about system settings and UA limitations.
Various editorial changes to clarify sort order.
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.
Clarify that Style rules outside of @media rules apply to the same media types that the style sheet itself applies to.
Added text to clarify that media types are mutually exclusive, but a UA can render simulatenously to canvases with different media types.
Split "aural" media group into "audio" and "speech".
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 a sentence to note that vertical margins have no effect on non-replaced inline elements.
Changed "absolute maximum" to "maximum of the absolute values" in sentence about negative margins collapsing.
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.
Emphasized that floating elements' margins do not collapse even between a float and its in-flow children.
Emphasized that absolutely positioned elements' margins do not collapse even between the positioned element and its in-flow children.
Changed description of 'none' value to not imply that all four border widths are set to zero.
Changed the sentence "When the viewport is smaller than the ..., the user agent should offer a scrolling mechanism" to use "area of the canvas on which the document is rendered" instead of "document's initial containing block".
Clarified that the margins of fixed positioned boxes do not collapse with any other margins.
Clarified that in print media fixed boxes are rendered on every page.
Clarified that negative lengths and percentages are allowed as values of 'top', 'right', 'bottom', and 'left'.
Added "For replaced elements, the effect of this value depends only on the intrinsic dimensions of the replaced content. See the sections on the width and height of absolutely positioned, replaced elements for details." to the definition of 'auto' because that's not what chapter 10 says at all.
Clarified that 'justify' stretches "spaces and words in inline boxes"; previous text simply said that it stretches "inline boxes".
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.
Clarified that an inline box that exceeds the width of a line box and cannot be split therefore overflows the line box.
Removed sentence about formatting of margins, borders, and padding for split inline boxes not being fully defined when affected by bidi as that situation is now defined in section 8.6.
Clarified that although relative positioning normally doesn't directly affect layout, it may affect layout indirectly through the creation of scrollbars.
Relatively positioned boxes do not always establish new containing blocks. Changed the second paragraph to refer to the section on containing blocks accordingly.
The paragraph about dynamic movement and superscripting has been shifted into a non-normative note.
Clarified that line boxes are shortened to make room for the margin box of the float.
Added some text to clarify what "Any content in the current line before a floated box is reflowed in the first available line on the other side of the float" means.
Clarified floats' position in the stacking order.
Clarified that the elements referenced in the float behavior rules are in the same block formatting context as the float.
Clarified that the effects of 'clear' do not consider floats in other block formatting contexts.
Added a note to clarify that the images in this section are not drawn to scale and are illustrations, not reference renderings.
Noted that a containing block formed by inline elements may wind up with a negative containing block width.
In the definition of <length> values for the 'width' property, changed "Specifies a fixed width" to "Specifies the width of the content area using a length unit".
Clarified that setting both left and right margins to 'auto' horizontally centers the element within its containing block.
Clarified that 'min-width' and 'max-width' do not affect the computed values of any properties. (They only affect the used value.)
Clarified that these rules apply to the root element just as to any other element.
Clarified that 'min-width' and 'max-width' do not affect the computed values of any properties. (They only affect the used value.)
Removed clarifying note about line height being taller than tallest single inline box due to vertical alignment.
Clarified when absolute positioning and negative margins cause overflow.
Added 'text-indent' to the list of things that can cause overflow.
Removed mention of 'clip' since it no longer affects most elements; mentioned that the 'overflow' property also specifies whether a scrolling mechanism is provided to access clipped content.
Clarified that descendant elements whose containing block is the viewport or an ancestor of the element are not affected by overflow clipping.
Removed unnecessary mentions of the 'clip' property from the 'hidden' value definition.
Changed "portion of an element's rendered content" to "portion of an element's border box" since clipping also affects the element's backgrounds and borders.
Clarified what parts of the element are affected by clipping.
Clarified that clipped content does not cause overflow.
Clarified that descendants of a 'visibility: hidden' element will be visible if they have 'visibility: visible'.
Clarified that :before and :after pseudo-elements interact with other boxes as if they were real elements just inside their associated element.
Noted that the interaction of :before and :after with replaced elements is left undefined for now.
Clarified which counters are used for counter() and counters() in case there are multiple counters of the same name.
Removed note about common typographic practices when quotes in different languages are mixed.
In the "self-nesting" behavior of counters, clarified that merely using a counter in a child element doesn't create a new instance of it: only resetting it does.
Clarified that the scope of a counter does not include any elements in the scope of a counter with the same name created by a 'counter-reset' on a later sibling or a later 'counter-reset' on the same element.
Removed sentence about scope of 'counter-increment' without prior 'counter-reset' as that is now defined (differently) under "12.4.1 Nested counters and scope."
Clarified that pseudo-elements that generate no boxes also do not increment counters.
Clarified that the root background image, although painted over the entire canvas, is anchored as if painted only for the root element, and that the root's background is only painted once.
Clarified rules for propagation of background settings on HTML's <body> element to the root.
Added statement about z-index of backgrounds for elements that form a stacking context and referred to z-index property for details.
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.
Definition of 'background-position' has been rewritten as normative rules rather than just examples.
Stated that the tiling and positioning of background images for inline elements is undefined in CSS2.1.
Drastically shortened introduction.
In the per-property rule 2, clarified that 'normal' matches the non-small-caps variant (if there is one).
Removed discussion of font-matching algorithm. (It is already covered in the font-matching algorithm's own section.
Clarified that quoted strings that are the same as a keyword value must be treated as font family names and not as the keyword value (which must be unquoted).
This section, previously section 15.2.6, has been moved but no other change was made.
The text for this section (formerly part of 15.2.3) has been reverted to its CSS1 format.
The text for this section (formerly part of 15.2.3) has been reverted to its CSS1 format.
Clarified that CSS2.1 cannot select font variants besides small-caps.
Clarified that when "font-variant: small-caps" results in the substitution of full-caps, the behavior is the same as for text-transform.
The text for this section (formerly part of 15.2.3) has been reverted to its CSS1 format. Also, discussion of font-weight from other parts of the Fonts chapter has been aggregated under this section.
Removed statemnt that says "User agents must map names to values in a way that preserves visual order; a face mapped to a value must not be lighter than faces mapped to lower values." This is otherwise implied by "The only guarantee is that a face of a given value will be no less dark than the faces of lighter values."
Clarified relationship of font size to em squares.
Added a totally irrelevant note about font sizes virtual reality scenes.
Clarified that text overflowing due to text-indent is affected by the 'overflow' property.
Added a note about text-indents inheriting behavior and suggesting 'text-indent: 0' on inline-blocks.
Changed "double justify" to "justify" under "left, right, center, and justify".
Added an example to illustrate how underlining affects descendant boxes.
Switched language reference from RFC2070 to RFC3066.
Added section 16.6.1 as an example to illustrate the interaction of white space collapsing and bidi.
Expanded introduction to include a brief discussion of the two table layout models. Mentioned that the automatic table algorithm is not fully defined in CSS 2.1 but that some implementations have achieved relatively close interoperability.
Clarify that all table captions must be rendered if more than one exists.
Specified that replaced elements with table display values are treated as table elements in table layout.
Moved the first bullet text to the prose before the list of generation rules as it is a general statement of what the rules are supposed to accomplish.
Clarified that "display: table" elements behave as block-level elements and "display: inline-table" elements behave as inline-level elements and not the other way around.
Clarified that 'table-caption' boxes behave as normal block boxes within the outer anonymous table box.
Clarified that percentage 'width' and 'height' on the table box is relative to the anonymous box's containing block, not the anonymous box itself.
Clarified that the 'position', 'float', 'top', 'right', 'bottom', and 'left' values on the table box are used on the anonymous outer box instead of the table box and that the table box itself uses the initial values of those properties.
To remove ambiguity about the position of extent of internal table boxes, the following paragraph was added after point 6:
the edges of the rows, columns, row groups and column groups in the collapsing borders model coincide with the hypothetical grid lines on which the borders of the cells are centered. (And thus, in this model, the rows together exactly cover the table, leaving no gaps; ditto for the columns.) In the separated borders model, the edges coincide with the border edges of cells. (And thus, in this model, there may be gaps between the rows and columns, corresponding to the 'border-spacing' property.)
Changed warning note about positioning of table cells to be more precise about the possibly unintended effects.
At the end of the section added the following paragraph:
Note that if the table has 'border-collapse: separate', the background of the area given by the 'border-spacing' property is always the background of the table element. See 17.6.1
Added a paragraph to clarify the interaction of the table width algorithms with the rules in section 10.3 (Calculating widths and margins).
Explicitly mentioned that the fixed table layout algorithm may be used with the algorithm of section 10.3.3 when 'table-layout' is 'fixed' but 'width' is 'auto'.
Clarified that UAs can use other algorithms besides the one in this section even if it results in different behavior. Also marked the rest of the section non-normative in accordance with that statement.
Clarified that not affecting layout means that 'visibility: collapse' causes the part of row- and column-spanning cells that span into the collapsed row to be clipped.
Added a note explaining that 'border-spacing' can be used as a substitute for the non-standard 'framespacing' attribute on frameset elements (which are out-of-scope for CSS2.1).
Added clarification about backgrounds: the sentence "This space is filled with the background of the table element" was replaced by:
In this space, the row, column, row group, and column group backgrounds are invisible, allowing the table background to show through.
In the sentence after the question, added "and padding-lefti and padding-righti refer to the left (resp., right) padding of cell i."
Noted that system colors are deprecated in CSS3.
Clarified that outlines do not cause overflow.
Clarified that outlines are only fully connected "if possible".
Clarify that changing outlines in response to focus should not cause a document to reflow.
Added paragraph clarifying that some presentational markup in HTML can be replaced with CSS, but it requires different markup.
In addition to lowercasing all HTML tag names, the following changes were made:
-ADDRESS, +html, address, BLOCKQUOTE, BODY, DD, DIV, -DL, DT, -FIELDSET, FORM, +dl, dt, fieldset, form, FRAME, FRAMESET, -H1, H2, H3, H4, -H5, H6, IFRAME, -NOFRAMES, +h1, h2, h3, h4, +h5, h6, noframes, -OBJECT, OL, P, -UL, APPLET, -CENTER, DIR, -HR, MENU, PRE { display: block } +ol, p, ul, center, +dir, hr, menu, pre { display: block } LI { display: list-item } HEAD { display: none } TABLE { display: table } TR { display: table-row } THEAD { display: table-header-group } TBODY { display: table-row-group } TFOOT { display: table-footer-group } COL { display: table-column } COLGROUP { display: table-column-group } TD, TH { display: table-cell } CAPTION { display: table-caption } TH { font-weight: bolder; text-align: center } CAPTION { text-align: center } -BODY { padding: 8px; line-height: 1.33 } +body { margin: 8px } H1 { font-size: 2em; margin: .67em 0 } -H2 { font-size: 1.5em; margin: .83em 0 } -H3 { font-size: 1.17em; margin: 1em 0 } +h2 { font-size: 1.5em; margin: .75em 0 } +h3 { font-size: 1.17em; margin: .83em 0 } H4, P, BLOCKQUOTE, UL, FIELDSET, FORM, OL, DL, DIR, -MENU { margin: 1.33em 0 } -H5 { font-size: .83em; line-height: 1.17em; margin: 1.67em 0 } -H6 { font-size: .67em; margin: 2.33em 0 } +menu { margin: 1.12em 0 } +h5 { font-size: .83em; margin: 1.5em 0 } +h6 { font-size: .75em; margin: 1.67em 0 } H1, H2, H3, H4, H5, H6, B, STRONG { font-weight: bolder } BLOCKQUOTE { margin-left: 40px; margin-right: 40px } I, CITE, EM, VAR, ADDRESS { font-style: italic } PRE, TT, CODE, KBD, SAMP { font-family: monospace } PRE { white-space: pre } +button, textarea, +input, select { display: inline-block } BIG { font-size: 1.17em } SMALL, SUB, SUP { font-size: .83em } SUB { vertical-align: sub } SUP { vertical-align: super } +table { border-spacing: 2px; } +thead, tbody, +tfoot { vertical-align: middle } +td, th { vertical-align: inherit } S, STRIKE, DEL { text-decoration: line-through } HR { border: 1px inset } OL, UL, DIR, MENU, DD { margin-left: 40px } OL { list-style-type: decimal } OL UL, UL OL, UL UL, OL OL { margin-top: 0; margin-bottom: 0 } U, INS { text-decoration: underline } -CENTER { text-align: center } BR:before { content: "\A" } - -/* An example of style for HTML 4.0's ABBR/ACRONYM elements */ - -ABBR, ACRONYM { font-variant: small-caps; letter-spacing: 0.1em } -A[href] { text-decoration: underline } +:before, :after { white-space: pre-line } +center { text-align: center } +:link, :visited { text-decoration: underline } :focus { outline: thin dotted invert } -/* Begin bidirectionality settings (do not change) */ +/* Begin bidirectionality settings (do not change) */ BDO[DIR="ltr"] { direction: ltr; unicode-bidi: bidi-override } BDO[DIR="rtl"] { direction: rtl; unicode-bidi: bidi-override } *[DIR="ltr"] { direction: ltr; unicode-bidi: embed } *[DIR="rtl"] { direction: rtl; unicode-bidi: embed } - -/* Elements that are block-level in HTML4 */ -ADDRESS, BLOCKQUOTE, BODY, DD, DIV, DL, DT, FIELDSET, -FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, IFRAME, -NOSCRIPT, NOFRAMES, OBJECT, OL, P, UL, APPLET, CENTER, -DIR, HR, MENU, PRE, LI, TABLE, TR, THEAD, TBODY, TFOOT, -COL, COLGROUP, TD, TH, CAPTION - { unicode-bidi: embed } -/* End bidi settings */ @media print { - @page { margin: 10% } + h1 { page-break-before: always } H1, H2, H3, - H4, H5, H6 { page-break-after: avoid; page-break-inside: avoid } + h4, h5, h6 { page-break-after: avoid } - BLOCKQUOTE, - PRE { page-break-inside: avoid } UL, OL, DL { page-break-before: avoid } } -@media speech { - H1, H2, H3, - H4, H5, H6 { voice-family: paul, male; stress: 20; richness: 90 } - H1 { pitch: x-low; pitch-range: 90 } - H2 { pitch: x-low; pitch-range: 80 } - H3 { pitch: low; pitch-range: 70 } - H4 { pitch: medium; pitch-range: 60 } - H5 { pitch: medium; pitch-range: 50 } - H6 { pitch: medium; pitch-range: 40 } - LI, DT, DD { pitch: medium; richness: 60 } - DT { stress: 80 } - PRE, CODE, TT { pitch: medium; pitch-range: 0; stress: 0; richness: 80 } - EM { pitch: medium; pitch-range: 60; stress: 60; richness: 50 } - STRONG { pitch: medium; pitch-range: 60; stress: 90; richness: 90 } - DFN { pitch: high; pitch-range: 60; stress: 60 } - S, STRIKE { richness: 0 } - I { pitch: medium; pitch-range: 60; stress: 60; richness: 50 } - B { pitch: medium; pitch-range: 60; stress: 90; richness: 90 } - U { richness: 0 } - A:link { voice-family: harry, male } - A:visited { voice-family: betty, female } - A:active { voice-family: betty, female; pitch-range: 80; pitch: x-high } -}
stylesheet
- : [ CHARSET_SYM S* STRING S* ';' ]?
+ : [ CHARSET_SYM STRING ';' ]?
[S|CDO|CDC]* [ import [S|CDO|CDC]* ]*
- [ [ ruleset | media | page | font_face ] [S|CDO|CDC]* ]*
+ [ [ ruleset | media | page ] [S|CDO|CDC]* ]*
;
import
: IMPORT_SYM S*
- [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
+ [STRING|URI] S* [ medium [ COMMA S* medium]* ]? ';' S*
;
media
- : MEDIA_SYM S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
+ : MEDIA_SYM S* medium [ COMMA S* medium ]* LBRACE S* ruleset* '}' S*
;
medium
: IDENT S*
;
page
- : PAGE_SYM S* IDENT? pseudo_page? S*
- '{' S* declaration [ ';' S* declaration ]* '}' S*
+ : PAGE_SYM S* pseudo_page? S*
+ LBRACE S* declaration [ ';' S* declaration ]* '}' S*
;
pseudo_page
: ':' IDENT
;
-font_face
- : FONT_FACE_SYM S*
- '{' S* declaration [ ';' S* declaration ]* '}' S*
- ;
operator
- : '/' S* | ',' S* | /* empty */
+ : '/' S* | COMMA S* | /* empty */
;
combinator
- : '+' S* | '>' S* | /* empty */
+ : PLUS S*
+ | GREATER S*
+ | S
;
unary_operator
- : '-' | '+'
+ : '-' | PLUS
;
property
: IDENT S*
;
ruleset
- : selector [ ',' S* selector ]*
- '{' S* declaration [ ';' S* declaration ]* '}' S*
+ : selector [ COMMA S* selector ]*
+ LBRACE S* declaration [ ';' S* declaration ]* '}' S*
;
selector
: simple_selector [ combinator simple_selector ]*
;
-/*
- * simple selector cannot start with attrib selector
- */
simple_selector
- : element_name [ HASH | class | attrib | pseudo ]* S*
- | HASH [ HASH | class | attrib | pseudo ]* S*
- | pseudo [ HASH | class | attrib | pseudo ]* S*
- | class [ HASH | class | attrib | pseudo ]* S*
+ : element_name [ HASH | class | attrib | pseudo ]*
+ | [ HASH | class | attrib | pseudo ]+
;
class
: '.' IDENT
@@ -108,7 +98,7 @@
[ IDENT | STRING ] S* ]? ']'
;
pseudo
- : ':' [ IDENT | FUNCTION S* IDENT S* ')' ]
+ : ':' [ IDENT | FUNCTION S* IDENT? S* ')' ]
;
declaration
: property ':' S* expr prio?
| /* empty */
;
prio
: IMPORTANT_SYM S*
;
expr
: term [ operator term ]*
;
term
: unary_operator?
[ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* |
- TIME S* | FREQ S* | function ]
- | STRING S* | IDENT S* | URI S* | RGB S* | UNICODERANGE S* | hexcolor
+ TIME S* | FREQ S* ]
+ | STRING S* | IDENT S* | URI S* | hexcolor | function
;
function
: FUNCTION S* expr ')' S*
%option case-insensitive h [0-9a-f] nonascii [\200-\377] -unicode \\{h}{1,6}[ \t\r\n\f]? +unicode \\{h}{1,6}(\r\n|[ \t\r\n\f])? -escape {unicode}|\\[ -~\200-\377] +escape {unicode}|\\[^\r\n\f0-9a-f] -nmstart [a-z]|{nonascii}|{escape} -nmchar [a-z0-9-]|{nonascii}|{escape} +nmstart [_a-z]|{nonascii}|{escape} +nmchar [_a-z0-9-]|{nonascii}|{escape} -string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\" -string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\' +string1 \"([^\n\r\f\\"]|\\{nl}|{escape})*\" +string2 \'([^\n\r\f\\']|\\{nl}|{escape})*\' +invalid1 \"([^\n\r\f\\"]|\\{nl}|{escape})* +invalid2 \'([^\n\r\f\\']|\\{nl}|{escape})* +comment \/\*[^*]*\*+([^/*][^*]*\*+)*\/ -ident {nmstart}{nmchar}* +ident -?{nmstart}{nmchar}* name {nmchar}+ num [0-9]+|[0-9]*"."[0-9]+ string {string1}|{string2} +invalid {invalid1}|{invalid2} url ([!#$%&*-~]|{nonascii}|{escape})* -w [ \t\r\n\f]* +s [ \t\r\n\f]+ +w {s}? nl \n|\r\n|\r|\f -range \?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h}))))) + +A a|\\0{0,4}(41|61)(\r\n|[ \t\r\n\f])? +C c|\\0{0,4}(43|63)(\r\n|[ \t\r\n\f])? +D d|\\0{0,4}(44|64)(\r\n|[ \t\r\n\f])? +E e|\\0{0,4}(45|65)(\r\n|[ \t\r\n\f])? +G g|\\0{0,4}(47|67)(\r\n|[ \t\r\n\f])?|\\g +H h|\\0{0,4}(48|68)(\r\n|[ \t\r\n\f])?|\\h +I i|\\0{0,4}(49|69)(\r\n|[ \t\r\n\f])?|\\i +K k|\\0{0,4}(4b|6b)(\r\n|[ \t\r\n\f])?|\\k +M m|\\0{0,4}(4d|6d)(\r\n|[ \t\r\n\f])?|\\m +N n|\\0{0,4}(4e|6e)(\r\n|[ \t\r\n\f])?|\\n +O o|\\0{0,4}(51|71)(\r\n|[ \t\r\n\f])?|\\o +P p|\\0{0,4}(50|70)(\r\n|[ \t\r\n\f])?|\\p +R r|\\0{0,4}(52|72)(\r\n|[ \t\r\n\f])?|\\r +S s|\\0{0,4}(53|73)(\r\n|[ \t\r\n\f])?|\\s +T t|\\0{0,4}(54|74)(\r\n|[ \t\r\n\f])?|\\t +X x|\\0{0,4}(58|78)(\r\n|[ \t\r\n\f])?|\\x +Z z|\\0{0,4}(5a|7a)(\r\n|[ \t\r\n\f])?|\\z %% -[ \t\r\n\f]+ {return S;} +{s} {return S;} -\/\*[^*]*\*+([^/][^*]*\*+)*\/ /* ignore comments */ +\/\*[^*]*\*+([^/*][^*]*\*+)*\/ /* ignore comments */ +{s}+\/\*[^*]*\*+([^/*][^*]*\*+)*\/ {unput(' '); /*replace by space*/} -"<!--" {return CDO;} +"<!--" {return CDO;} "-->" {return CDC;} "~=" {return INCLUDES;} "|=" {return DASHMATCH;} +{w}"{" {return LBRACE;} +{w}"+" {return PLUS;} +{w}">" {return GREATER;} +{w}"," {return COMMA;} + {string} {return STRING;} +{invalid} {return INVALID; /* unclosed string */} {ident} {return IDENT;} "#"{name} {return HASH;} -"@import" {return IMPORT_SYM;} -"@page" {return PAGE_SYM;} -"@media" {return MEDIA_SYM;} -"@font-face" {return FONT_FACE_SYM;} -"@charset" {return CHARSET_SYM;} -"@"{ident} {return ATKEYWORD;} +@{I}{M}{P}{O}{R}{T} {return IMPORT_SYM;} +@{P}{A}{G}{E} {return PAGE_SYM;} +@{M}{E}{D}{I}{A} {return MEDIA_SYM;} +@{C}{H}{A}{R}{S}{E}{T} {return CHARSET_SYM;} -"!{w}important" {return IMPORTANT_SYM;} +"!"({w}|{comment})*{I}{M}{P}{O}{R}{T}{A}{N}{T} {return IMPORTANT_SYM;} -{num}em {return EMS;} -{num}ex {return EXS;} -{num}px {return LENGTH;} -{num}cm {return LENGTH;} -{num}mm {return LENGTH;} -{num}in {return LENGTH;} -{num}pt {return LENGTH;} -{num}pc {return LENGTH;} -{num}deg {return ANGLE;} -{num}rad {return ANGLE;} -{num}grad {return ANGLE;} -{num}ms {return TIME;} -{num}s {return TIME;} -{num}Hz {return FREQ;} -{num}kHz {return FREQ;} -{num}{ident} {return DIMEN;} +{num}{E}{M} {return EMS;} +{num}{E}{X} {return EXS;} +{num}{P}{X} {return LENGTH;} +{num}{C}{M} {return LENGTH;} +{num}{M}{M} {return LENGTH;} +{num}{I}{N} {return LENGTH;} +{num}{P}{T} {return LENGTH;} +{num}{P}{C} {return LENGTH;} +{num}{D}{E}{G} {return ANGLE;} +{num}{R}{A}{D} {return ANGLE;} +{num}{G}{R}{A}{D} {return ANGLE;} +{num}{M}{S} {return TIME;} +{num}{S} {return TIME;} +{num}{H}{Z} {return FREQ;} +{num}{K}{H}{Z} {return FREQ;} +{num}{ident} {return DIMENSION;} {num}% {return PERCENTAGE;} {num} {return NUMBER;} "url("{w}{string}{w}")" {return URI;} "url("{w}{url}{w}")" {return URI;} {ident}"(" {return FUNCTION;} -U\+{range} {return UNICODERANGE;} -U\+{h}{1,6}-{h}{1,6} {return UNICODERANGE;} - . {return *yytext;}