CSS3 module: Syntax

W3C Working Draft 13 August 2003

This version:
Latest version:
Previous version:
L. David Baron, <dbaron@dbaron.org>
Additional Contributors:
Original CSS2 Authors
Bert Bos (W3C), <bert@w3.org>
Peter Linss (Netscape)


This CSS3 module describes the basic structure of CSS style sheets, some of the details of the syntax, and the rules for parsing CSS style sheets. It also describes (in some cases, informatively) how stylesheets can be linked to documents and how those links can be media-dependent. Additional details of the syntax of some parts of CSS described in other modules will be described in those modules. The selectors module has a grammar for selectors. Modules that define properties give the grammar for the values of those properties, in a format described in this document.

Status of this document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/. The latest revision can also be found by following the "Latest Version" link above.

This document is a draft of one of the modules of CSS Level 3 (CSS3). Some parts of the document are derived from the CSS Level 1 and CSS Level 2 recommendations, and those parts are thus relatively stable. However, it is otherwise an early draft, and considerable revision is expected in later drafts, especially in formalization of error handling behavior, the conformance requirements for partial implementations (given the modularization of CSS3), and integration with other CSS3 modules.

This document is a working draft of the CSS working group which is part of the style activity (see summary).

The working group would like to receive feedback: discussion takes place on the (archived) public mailing list www-style@w3.org (see instructions). W3C Members can also send comments directly to the CSS working group.

This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. Its publication does not imply endorsement by the W3C membership or the CSS & FP Working Group (members only).

Patent disclosures relevant to CSS may be found on the Working Group's public patent disclosure page.

This document may be available in translations in the future. The English version of this specification is the only normative version.

Table of contents

1. Dependencies on other modules

This CSS3 module depends on the following other CSS3 modules:

It has non-normative (informative) references to the following other CSS3 modules:

2. Introduction

This specification describes the basic syntax of CSS3 and the syntax conventions used in the property definitions spread through the CSS3 modules. The syntax of CSS3 has some error-handling requirements for forward-compatibility, but much of the error-handling behavior depends on the user agent.

3. CSS style sheet representation

A CSS style sheet is a sequence of characters from the Universal Character Set (see [ISO10646]). For transmission and storage, these characters must be encoded by a character encoding that supports the set of characters available in US-ASCII (e.g., ISO-8859-x, Shift_JIS, etc.). A byte order mark (BOM), as described in section 2.7 of [UNICODE310], that begins the sequence of characters should not be considered, for purposes of applying the grammar below, as a part of the style sheet. For a good introduction to character sets and character encodings, please consult the HTML 4.0 specification ([HTML40], chapter 5). See also the XML 1.0 specification ([XML10], sections 2.2 and 4.3.3).

When a style sheet is embedded in another document, such as in the STYLE element or "style" attribute of HTML, the style sheet shares the character encoding of the whole document.

When a style sheet resides in a separate file, user agents must observe the following priorities when determining a style sheet's character encoding (from highest priority to lowest):

  1. A character encoding specified by a higher level protocol (e.g., the "charset" parameter to the MIME type specified in an HTTP "Content-Type" field). (The HTTP protocol ([HTTP11], section 3.7.1) mentions ISO-8859-1 as a default character encoding when the "charset" parameter is absent from the "Content-Type" header field. In practice, this recommendation has proved useless because some servers don't allow a "charset" parameter to be sent, and others may not be configured to send the parameter. Therefore, user agents must not assume any default value for the "charset" parameter, but must instead look for the @charset rule.)
  2. The @charset at-rule.
  3. Assume that the style sheet is UTF-8.

Since the third point differs from CSS1 and CSS2, authors should not rely on user agents to assume that style sheets without encoding information are UTF-8 encoded. Authors should specify the encoding using one of the first two methods.

At most one @charset rule may appear in an external style sheet — it must not appear in an embedded style sheet — and it must appear at the very start of the style sheet, not preceded by any characters (except for the optional Byte Order Mark described above). After "@charset", authors specify the name of a character encoding. The name must be a charset name as described in the IANA registry (See [RFC2978]. Also, see [CHARSETS] for a complete list of charsets). For example:

@charset "ISO-8859-1";

This specification does not mandate which character encodings a user agent must support. [Should we require a certain minimal set, such as UTF-8 and UCS2?]

Note that reliance on the @charset construct theoretically poses a problem since there is no a priori information on how it is encoded. In practice, however, the encodings in wide use on the Internet are either based on ASCII, UTF-16, UCS-4, or (rarely) on EBCDIC. This means that in general, the initial byte values of a style sheet enable a user agent to detect the encoding family reliably, which provides enough information to decode the @charset rule, which in turn determines the exact character encoding.

[Should this specification describe how to handle encoding errors? Can a user agent ignore the @charset rule if it's wrong? What if the user agent does not support the encoding used? Should this specification describe how to handle a @charset rule that specifies a character encoding that is incompatible with the family of encodings used to decode the @charset rule (and BOM) itself?]

3.1. Referring to characters not represented in a character encoding

A style sheet may have to refer to characters that cannot be represented in the current character encoding. These characters must be written as escaped references to ISO 10646 characters. These escapes serve the same purpose as numeric character references in HTML or XML documents (see [HTML40], chapters 5 and 25).

The character escape mechanism should be used when only a few characters must be represented this way. If most of a style sheet requires escaping, authors should encode it with a more appropriate encoding (e.g., if the style sheet contains a lot of Greek characters, authors might use "ISO-8859-7" or "UTF-8").

Intermediate processors using a different character encoding may translate these escaped sequences into byte sequences of that encoding. Intermediate processors must not, on the other hand, alter escape sequences that cancel the special meaning of an ASCII character.

Conforming user agents must correctly map to Unicode all characters in any character encodings that they recognize (or they must behave as if they did).

For example, a style sheet transmitted as ISO-8859-1 (Latin-1) cannot contain Greek letters directly: "κουρος" (Greek: "kouros") has to be written as "\3BA\3BF\3C5\3C1\3BF\3C2".

Note. In HTML 4.0, numeric character references are interpreted in "style" attribute values but not in the content of the STYLE element. Because of this asymmetry, we recommend that authors use the CSS character escape mechanism rather than numeric character references for both the "style" attribute and the STYLE element. For example, we recommend:

<span style="voice-family: D\FC rst">...</span>

rather than:

<span style="voice-family: D&#252;rst">...</span>

3.2. The text/css content type

CSS style sheets that exist in separate files are sent over the Internet as a sequence of bytes accompanied by encoding information. The structure of the transmission, termed a message entity, is defined by MIME and HTTP 1.1 (see [RFC2045] and [HTTP11]). A message entity with a content type of "text/css" represents an independent CSS style sheet. The "text/css" content type has been registered by RFC 2318 ([RFC2318]).

4. General syntax of CSS

This section describes a grammar (and forward-compatible parsing rules) common to any version of CSS (including CSS3). Future versions of CSS will adhere to this core syntax, although they may add additional syntactic constraints.

See the section on characters and case for information on case-sensitivity.

These descriptions are normative.

4.1. Characters and case

The following rules always hold:

4.2. Tokenization

[This needs to be integrated with the selectors module. How should that be done?]

All levels of CSS — level 1, level 2, level 3, and any future levels — use the same core syntax. This allows UAs to parse (though not completely understand) style sheets written in levels of CSS that didn't exist at the time the UAs were created. Designers can use this feature to create style sheets that work with older user agents, while also exercising the possibilities of the latest levels of CSS.

At the lexical level, CSS style sheets consist of a sequence of tokens. Hexadecimal codes (e.g., #x20) refer to ISO 10646 ([ISO10646]). In case of multiple matches, the longest match determines the token.

The following productions are parts of tokens:

[We need something to allow signs on integers. Do we need to go as far as css3-selectors?]

ident ::= '-'? nmstart nmchar*
name ::= nmchar+
nmstart ::= [a-zA-Z] | '_' | nonascii | escape
nonascii ::= [#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
unicode ::= '\' [0-9a-fA-F]{1,6} wc?
escape ::= unicode | '\' [#x20-#x7E#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
nmchar ::= [a-zA-Z0-9] | '-' | '_' | nonascii | escape
num ::= [0-9]+ | [0-9]* '.' [0-9]+
string ::= '"' (stringchar | "'")* '"' | "'" (stringchar | '"')* "'"
stringchar ::= urlchar | #x20 | '\' nl
urlchar ::= [#x9#x21#x23-#x26#x27-#x7E] | nonascii | escape
nl ::= #xA | #xD #xA | #xD | #xC
w ::= wc*
wc ::= #x9 | #xA | #xC | #xD | #x20

The following productions are the complete list of tokens in CSS3:

IDENT ::= ident
ATKEYWORD ::= '@' ident
STRING ::= string
HASH ::= '#' name
NUMBER ::= num
PERCENTAGE ::= num '%'
DIMENSION ::= num ident
URI ::= "url(" w (string | urlchar* ) w ")"
UNICODE-RANGE ::= "U+" [0-9A-F?]{1,6} ('-' [0-9A-F]{1,6})?
CDO ::= "<!--"
CDC ::= "-->"
S ::= wc+
COMMENT ::= "/*" [^*]* '*'+ ([^/] [^*]* '*'+)* "/"
FUNCTION ::= ident '('
INCLUDES ::= "~="
DASHMATCH ::= "|="
CHAR ::= any other character not matched by the above rules, except for " or '
BOM ::= #xFEFF

Since any single character other than ' or " that cannot be part of a larger token is a single character token, there cannot be errors in tokenization other than the inability to tokenize an unmatched quotation mark. If at some point it is not possible to continue tokenizing an incoming style sheet, the remainder of the style sheet should be ignored and only the largest initial segment of the style sheet that can be tokenized according to the above rules (that is, the entire style sheet except for the part from the unmatched (single or double) quotation mark to the end) should be used to form the sequence of tokens to be parsed according to the grammar.

[This isn't exactly right. Since the string token can't contain newlines that aren't escaped by backslashes, an untokenizable sequence can occur in the middle of a file. Would it be better to change things so that unmatched quotation marks become single-character tokens and all character streams are tokenizable?]

4.3. Grammar

4.3.1. Principles of CSS error handling

All levels of CSS, starting from CSS1, have required that user agents ignore certain types of invalid style sheets in well-defined ways. This allows forward-compatibility, since it allows future extensions to CSS within basic grammatical constraints that will be ignored in well-defined ways by user agents implementing earlier versions of CSS.

Handling of CSS that is not valid CSS3 but is valid according to the forward-compatible syntax requires first determining the beginning and end of the part that is invalid and then handling that part in a specified way. The latter is described in the rules for handling parsing errors. The mechanism for the former is described within the grammar.

The handling of style sheets that do not parse according to the forward-compatible core syntax is not defined by this specification. [Should it be?]

Certain productions within the grammar are error handling points. Every error handling point has a backup production that is to be used if it is not possible to parse the stream of tokens based on the primary production. If the error handling production is represented as prod, then the backup production is represented as FAIL(prod).

[The grammar given in Appendix D of CSS2 still needs to be incorporated into this specification. The editor hopes that it can be done by unifying it with the forward-compatible grammar into a single grammar that describes both the rules for forward-compatible parsing and the syntax of what is currently possible in CSS, but that may not be possible. However, hopefully it will be possible to do this by describing the general grammar in terms of the concepts described in the previous paragraph.]

Excluding the transformation of a production into its backup production, this grammar is LL(1). [We should explain briefly what this means, except that it's probably not true. It's probably just LALR(1).]

The portion of a CSS style sheet that is to be used is the largest initial stream of the tokens resulting from the tokenization process that can be parsed according to the grammar presented in this chapter. (For example, if a brace closing a declaration block [link-ify this] is not present, the declaration block must be ignored since the closing brace is required to satisfy this grammar.) [This might lead to highly unexpected behavior when there's an extra closing brace (etc.). Do we really want this?]

Some of the constraints of CSS are not expressed in the grammar. For example, an @charset rule is not permitted in an embedded style sheet, or a namespace prefix that has not been defined by an @namespace rule is an invalid selector. These constraints should be handled just as a parsing error would be (by ignoring out to the next backup production) unless specified otherwise.

4.3.2. Style sheets

Below is the core syntax for CSS. Lowercase identifiers represent productions in this grammar, uppercase identifiers represent tokens (see above), and characters in single quotes (') represent CHAR tokens (see above). The sections that follow describe how to use it.

[This might need better integration with the selectors module, although maybe it's ok.]

stylesheet  : [ CDO | CDC | S | statement ]*;
statement   : ruleset | at-rule;
at-rule     : ATKEYWORD S* any* [ block | ';' S* ];
block       : '{' S* [ any | block | ATKEYWORD S* | ';' S* ]* '}' S*;
ruleset     : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*;
selector    : any+;
declaration : property ':' S* value;
property    : IDENT S*;
value       : [ any | block | ATKEYWORD S* ]+;
              | FUNCTION S* any* ')' | DASHMATCH | '(' S* any* ')'
              | '[' S* any* ']' ] S*;
[The definitions of these productions should be spread below into the prose describing what they mean. Furthermore, they should be combined with the Appendix D grammar from CSS2, perhaps using notation like:
ruleset ::= ...
FAIL(ruleset) ::= ...

COMMENT tokens do not occur in the grammar (to keep it readable), but any number of these tokens may appear anywhere between other tokens.

The token S in the grammar above stands for whitespace. Only the characters "space" (Unicode code 32), "tab" (9), "line feed" (10), "carriage return" (13), and "form feed" (12) can occur in whitespace. Other space-like characters, such as "em-space" (8195) and "ideographic space" (12288), are never part of whitespace.

4.4. Keywords

Keywords have the form of identifiers. Keywords must not be placed between quotes ("..." or '...'). Thus,


is a keyword, but


is not. (It is a string.) Other illegal examples:

width: "auto";
border: "none";
background: "red";

4.5. Statements

A CSS style sheet, for any version of CSS, consists of a list of statements (see the grammar above). There are two kinds of statements: at-rules and rule sets. There may be whitespace around the statements.

4.6. At-rules

At-rules start with an at-keyword, an '@' character followed immediately by an identifier (for example, '@import', '@page').

An at-rule consists of everything up to and including the next semicolon (;) or the next block, whichever comes first. A CSS user agent that encounters an unrecognized or misplaced at-rule must ignore the whole of the at-rule and continue parsing after it.

Assume, for example, that a CSS3 parser encounters this style sheet:

@import "subs.css";
h1 { color: blue }
@import "list.css";

The second '@import' is illegal according to CSS3 since '@import' rules must occur before all rules other than '@charset' rules. The CSS3 parser ignores the whole at-rule, effectively reducing the style sheet to:

@import "subs.css";
h1 { color: blue }

In the following example, the second '@import' rule is invalid, since it occurs inside a '@media' block.

@import "subs.css";
@media print {
  @import "print-main.css";
  BODY { font-size: 10pt }
h1 {color: blue }

4.7. Blocks

A block starts with a left curly brace ({) and ends with the matching right curly brace (}). In between there may be any characters, except that parentheses (( )), brackets ([ ]) and braces ({ }) must always occur in matching pairs and may be nested. Single (') and double quotes (") must also occur in matching pairs, and characters between them are parsed as a string. See Tokenization above for the definition of a string.

Here is an example of a block. Note that the right brace between the double quotes does not match the opening brace of the block, and that the second single quote is an escaped character, and thus doesn't match the first single quote:

{ causta: "}" + ({7} * '\'') }

Note that the above rule is not valid CSS3, but it is still a block as defined above.

4.8. Rule sets, declaration blocks, and selectors

A rule set (also called "rule") consists of a selector followed by a declaration block.

A declaration-block (also called a {}-block in the following text) starts with a left curly brace ({) and ends with the matching right curly brace (}). In between there must be a list of zero or more semicolon-separated (;) declarations.

The selector (see the Selectors module [SELECT]) consists of everything up to (but not including) the first left curly brace ({). A selector always goes together with a {}-block. When a user agent can't parse the selector (i.e., it is not valid CSS3), it must ignore the {}-block as well.

CSS3 gives a special meaning to the comma (,) in selectors. However, since it is not known if the comma may acquire other meanings in future versions of CSS, the whole statement should be ignored if there is an error anywhere in the selector, even though the rest of the selector may look reasonable in CSS3.

For example, since the "&" is not a valid token in a CSS3 selector, a CSS3 user agent must ignore the whole second line, and not set the color of H3 to red:

h1, h2 {color: green }
h3, h4 & h5 {color: red }
h6 {color: black }

Here is a more complex example. The first two pairs of curly braces are inside a string, and do not mark the end of the selector. This is a valid CSS3 statement.

p[example="public class foo\
    private int x;\
    foo(int x) {\
        this.x = x;\
}"] { color: red }

Note. The \ characters in the above example cause the newlines to be ignored. Newlines can be placed in strings only using the correct numeric character escape. See characters and case above.

4.9. Declarations and properties

A declaration is either empty or consists of a property, followed by a colon (:), followed by a value. Around each of these there may be whitespace.

Because of the way selectors work, multiple declarations for the same selector may be organized into semicolon (;) separated groups.

Thus, the following rules:

h1 { font-weight: bold }
h1 { font-size: 2em }
h1 { line-height: 1.2 }
h1 { font-family: Helvetica, Arial, sans-serif }
h1 { font-variant: normal }
h1 { font-style: normal }

are equivalent to:

h1 {
  font-weight: bold;
  font-size: 2em;
  line-height: 1.2;
  font-family: Helvetica, Arial, sans-serif; 
  font-variant: normal;
  font-style: normal

A property is an identifier. Any character may occur in the value, but parentheses ("( )"), brackets ("[ ]"), braces ("{ }"), single quotes (') and double quotes (") must come in matching pairs, and semicolons not in strings must be escaped. Parentheses, brackets, and braces may be nested. Inside the quotes, characters are parsed as a string.

The syntax of values is specified separately for each property, but in any case, values are built from identifiers, strings, numbers, lengths, percentages, URIs, colors, angles, times, and frequencies.

A user agent must ignore a declaration with an invalid property name or an invalid value. Every CSS3 property has its own syntactic and semantic restrictions on the values it accepts.

For example, assume a CSS3 parser encounters this style sheet:

h1 { color: red; font-style: 12px }  /* Invalid value: 12px */
p { color: blue;  font-vendor: any;  /* Invalid prop.: font-vendor */
    font-variant: small-caps }
em em { font-style: normal }

The second declaration on the first line has an invalid value '12pt'. The second declaration on the second line contains an undefined property 'font-vendor'. The CSS3 parser will ignore these declarations, effectively reducing the style sheet to:

h1 { color: red; }
p { color: blue;  font-variant: small-caps }
em em { font-style: normal }


Comments begin with the characters "/*" and end with the characters "*/". They may occur anywhere between tokens, and their contents have no influence on the rendering. Comments may not be nested.

CSS also allows the SGML comment delimiters ("<!--" and "-->") in certain places, but they do not delimit CSS comments. They are permitted so that style rules appearing in an HTML source document (in the STYLE element) may be hidden from pre-HTML 3.2 user agents. See the HTML 4.0 specification ([HTML40]) for more information.

5. Rules for handling parsing errors or unsupported features

[Hopefully (assuming it can be formalized within the rules above) this section will not need so much detail and can be folded into the previous section.]

In some cases, user agents must ignore part of an illegal style sheet. This specification defines ignore to mean that the user agent parses the illegal part according to the grammar above (in order to find its beginning and end), but otherwise acts as if it had not been there.

If a style sheet cannot be parsed according to the grammar above, the user agent must behave the same as it would if the style sheet had the smallest sequence of characters removed from its end that would allow it to be parsed according to the grammar.

To ensure that new properties and new values for existing properties can be added in the future, user agents are required to obey the following rules when they encounter the following scenarios:

5.1. Partial implementations

CSS3, unlike CSS1 and CSS2, is modular and thus allows for partial implementations. The conformance requirements of some modules may also allow for conformant implementations to implement only part of a module.

Implementations that do not implement a feature of any CSS3 module (whether a property, an at-rule, or a property value) should behave as they would according to the forward-compatible parsing rules had that feature not been part of a known CSS specification.

6. Vendor-specific extensions

Although proprietary extensions should be avoided in general, there are situations (experiments, implementations of W3C drafts that have not yet reached Candidate Recommendation, intra-nets, debugging, etc.) where it is convenient to add some nonstandard, i.e., proprietary identifiers to a CSS style sheet. It is often hard to predict how long these proprietary extensions will be in use and hard to avoid that their names clash with new, standard properties or with other proprietary properties. Therefore the CSS Working Group proposes the following simple naming convention. A proprietary name should have a prefix consisting of:

  1. an underscore ("_") or a dash ("-"),
  2. the (possibly abbreviated) name of the company, organization, etc. that created it,
  3. an underscore or a dash.

Some examples (and the companies/organizations that created them):

The advantage of the initial dash is that it is not a valid start character for identifiers in CSS, so it is guaranteed never to be used by any current or future level of CSS. CSS-conforming parsers will skip rules that contain identifiers with such a character. [Should the grammar allow '-' as part of identifiers or should it require that vendors who use '-' to begin identifiers extend the grammar in their tokenizer? Currently it does, but perhaps it shouldn't.]

That is also a possible disadvantage: a conforming parser will skip them, so in order to use them, an extended parser is required.

For that reason, the underscore is also proposed. Although it is a valid start character, the CSS Working Group believes it will never define any identifiers that start with that character.

6.1. Historical notes

This section is informative, not normative.

Microsoft created a number of proprietary properties for use inside their Microsoft Office product, at a time when there was not yet a consensus in the working group about the naming convention. They chose to prefix properties with "mso-" rather than "-mso-".

At the time of writing, the following prefixes are known to exist:

7. Associating style sheets with documents

7.1. Media types

[This section lacks testable statements.]

7.1.1. Introduction to media types

One of the most important features of style sheets is that they specify how a document is to be presented on different media: on the screen, on paper, with a speech synthesizer, with a braille device, etc.

Certain CSS properties are only designed for certain media (e.g., the 'page-break-before' property only applies to paged media). On occasion, however, style sheets for different media types may share a property, but require different values for that property. For example, the 'font-size' property is useful both for screen and print media. The two media types are different enough to require different values for the common property; a document will typically need a larger font on a computer screen than on paper. Therefore, it is necessary to express that a style sheet, or a section of a style sheet, applies to certain media types.

7.1.2. Specifying media-dependent style sheets

There are currently two ways to specify media dependencies for style sheets:

7.1.3. The @media rule

An @media rule specifies the target media types (separated by commas) of a set of rules (delimited by curly braces). The @media construct allows style sheet rules for various media in the same style sheet:

  @media print {
    body { font-size: 12pt; }
    h1 { font-size: 24pt; }
  @media screen {
    body { font-size: medium; }
    h1 { font-size: 2em; }
  @media screen, print {
    body { line-height: 1.2; }

7.1.4. Recognized media types

A CSS media type names a set of CSS properties. A user agent that claims to support a media type by name must implement all of the properties that apply to that media type. [This needs to be relaxed to deal with profiles.] (For the 'all' media type, this means that it must support all properties that apply to all media types. [Should all be removed from the list and separated to make this more logical?])

The names chosen for CSS media types reflect target devices for which the relevant properties make sense. The names of media types are normative. In the following list of CSS media types, the parenthetical descriptions are not normative. Likewise, the "Media" field in the description of each property is informative.

Suitable for all devices.
Intended for braille tactile feedback devices.
Intended for paged braille printers.
Intended for handheld devices (typically small screen, limited bandwidth).
Intended for paged material and for documents viewed on screen in print preview mode. Please consult the paged media module [CSS3PAGE] for information about formatting issues that are specific to paged media.
Intended for projected presentations. Please consult the paged media module [CSS3PAGE] for information about formatting issues that are specific to paged media.
Intended primarily for color computer screens.
Intended for speech synthesizers. See the speech module [CSS3SPEECH] for details.
Intended for media using a fixed-pitch character grid (such as teletypes, terminals, or portable devices with limited display capabilities).
Intended for television-type devices (low resolution, color, limited-scrollability screens, sound available).

Media type names are case-insensitive.

Media types are mutually exclusive in the sense that a user agent can only support one media type when rendering a document. However, user agents may have different modes which support different media types.

Note. Future versions of CSS may extend this list. Authors should not rely on media type names that are not yet defined by a CSS specification.

7.1.5. Extensions to media types

The Media Queries Module [MEDIAQ] defines an extended mechanism for media type specification.

7.2. User-agent style sheets

7.3. User style sheets

7.4. Author style sheets

This section is informative, not normative.

[This section should briefly summarize the mechanisms for associating author style sheets with documents provided by [HTML40], [CSSSTYLEATTR] and [XMLSTYLE].]

7.5. Style sheets including other style sheets: the @import rule

[When this section is rewritten to define user agent conformance more clearly, it should state that (1) the media list specified in an @import rule prevents the import from being processed if the medium doesn't match, but it doesn't "associate" the media with the style sheet so that it can't be imported some other way. (2) @import without a medium must ignore any medium specified for the same style sheet in a link from a document.]

[Should the discussion of how imported stylesheets affect the cascade's notion of order be here or in [CSS3CASCADE]? It probably depends on which direction the module dependency goes.]

The '@import' rule allows users to import style rules from other style sheets. Any @import rules must follow all @charset rules and precede all other at-rules and rule sets in a style sheet. The '@import' keyword must be followed by the URI of the style sheet to include. A string is also allowed; it will be interpreted as if it had url(...) around it.

The following lines are equivalent in meaning and illustrate both '@import' syntaxes (one with "url()" and one with a bare string):

@import "mystyle.css";
@import url("mystyle.css");

So that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent @import rules. These conditional imports specify comma-separated media types after the URI.

The following rules illustrate how @import rules can be made media-dependent:

@import url("fineprint.css") print;
@import url("bluish.css") projection, tv;

In the absence of any media types, the import is unconditional. Specifying 'all' for the medium has the same effect.

8. Defining namespaces: the @namespace rule

The @namespace rule allows the style sheet author to declare a namespace prefix and associate it to a given namespace URI. The prefix applies only to the style sheet in which it is declared, and not any style sheets imported by that style sheet, style sheets that import that stylesheet, or any other style sheets applying to the document. This namespace prefix can then be used as a namespace prefix as described in other modules, for example the Selectors Module [SELECT] or the Generated Content module [CSS3GENCON]. Any @namespace rules must follow all @import and @charset rules and precede all other at-rules and rule sets in a style sheet. This is to avoid any confusion or issues regarding the scope of the declared namespace.

If the optional namespace prefix is omitted, then the namespace URI is considered to be the default namespace. The default namespace applies only to type selectors that have no explicit namespace prefix declared as described in the Selectors Module [SELECT].

A prefix, once declared, may be used in selectors and property values as described in other modules. Those modules should define the use of a namespace prefix that has not been properly declared as a parsing error that will cause the selector or declaration (etc.) to be considered invalid and ignored.

If a namespace prefix is declared more than once, the last occurrence will be used.


@namespace url(http://www.w3.org/1999/xhtml);
@namespace svg url(http://www.w3.org/2000/svg);

The first rule declares a default namespace http://www.w3.org/1999/xhtml to be applied only to type selectors that have no explicit namespace component.

The second rule declares a namespace prefix svg that is used to apply the namespace http://www.w3.org/2000/svg where the svg namespace prefix is used.

9. Conformance

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 (see [RFC2119]). However, for readability, these words do not appear in all uppercase letters in this specification.

At times, this specification recommends good practice for authors and user agents. These recommendations are not normative and conformance with this specification does not depend on their realization. These recommendations contain the expression "We recommend ...", "This specification recommends ...", or some similar wording.

9.1. Definitions

[Some of these need heavy rewriting given modularization. I've avoided substituting CSS3 where it's clearly not going to be appropriate.]

This module and other CSS3 modules rely on the following definitions:

Style sheet
A set of statements that specify presentation of a document.

Style sheets may have three different origins: author, user, and user agent. The interaction of these sources is described in the cascading and inheritance module [CSS3CASCADE].

Valid style sheet
The validity of a style sheet depends on the level of CSS used for the style sheet. All valid CSS1 style sheets are valid CSS 2.1 style sheets, but some changes from CSS1 mean that a few CSS1 style sheets will have slightly different semantics in CSS 2.1. Some features in CSS2 are not part of CSS 2.1, so not all CSS2 style sheets are valid CSS 2.1 style sheets.

A valid CSS 2.1 style sheet must be written according to the grammar of CSS 2.1. Furthermore, it must contain only at-rules, property names, and property values defined in this specification. An illegal (invalid) at-rule, property name, or property value is one that is not valid.

Source document
The document to which one or more style sheets apply. This is encoded in some language that represents the document as a tree of elements. Each element consists of a name that identifies the type of element, optionally a number of attributes, and a (possibly empty) content.
Document language
The encoding language of the source document (e.g., HTML, XHTML or SVG). CSS is used to describe the presentation of document languages and CSS does not change the underlying semantics of the document languages.
(An SGML term, see [ISO8879].) The primary syntactic constructs of the document language. Most CSS style sheet rules use the names of these elements (such as P, TABLE, and OL in HTML) to specify how the elements should be rendered.
Replaced element
An element for which the CSS formatter knows only the intrinsic dimensions. In HTML, IMG and OBJECT elements can be replaced elements. For example, the content of the IMG element is often replaced by the image that the "src" attribute designates.
Intrinsic dimensions
The width and height as defined by the element itself, not imposed by the surroundings. CSS does not define how the intrinsic dimensions are found. In CSS 2.1 it is assumed that all replaced elements, and only replaced elements, come with intrinsic dimensions.
A value associated with an element, consisting of a name, and an associated (textual) value.
The content associated with an element in the source document. Some elements have no content, in which case they are called empty. The content of an element may include text, and it may include a number of sub-elements, in which case the element is called the parent of those sub-elements.
This term has three slightly different meanings in this specification. First, a CSS parser must follow certain rules when it discovers unknown or illegal syntax in a style sheet. The parser must then ignore certain parts of the style sheets. The exact rules for what parts must be ignored is given in these section: Declarations and properties, Rules for handling parsing errors, Unsupported Values, or may be explained in the text where the term "ignore" appears. Second, a user agent may (and, in some cases must) disregard certain properties or values in the style sheet even if the syntax is legal. For example, table-column-group elements cannot have borders around them, so the border properties must be ignored.
Rendered content
The content of an element after the rendering that applies to it according to the relevant style sheets has been applied. The rendered content of a replaced element comes from outside the source document. Rendered content may also be alternate text for an element (e.g., the value of the XHTML "alt" attribute), and may include items inserted implicitly or explicitly by the style sheet, such as bullets, numbering, etc.
Document tree
The tree of elements encoded in the source document. Each element in this tree has exactly one parent, with the exception of the root element, which has none.
An element A is called the child of element B if and only if B is the parent of A.
An element A is called a descendant of an element B, if either (1) A is a child of B, or (2) A is the child of some element C that is a descendant of B.
An element A is called an ancestor of an element B, if and only if B is a descendant of A.
An element A is called a sibling of an element B, if and only if B and A share the same parent element. Element A is a preceding sibling if it comes before B in the document tree. Element B is a following sibling if it comes after A in the document tree.
Preceding element
An element A is called a preceding element of an element B, if and only if (1) A is an ancestor of B or (2) A is a preceding sibling of B.
Following element
An element A is called a following element of an element B, if and only if B is a preceding element of A.
An author is a person who writes documents and associated style sheets. An authoring tool generates documents and associated style sheets.
A user is a person who interacts with a user agent to view, hear, or otherwise use a document and its associated style sheet. The user may provide a personal style sheet that encodes personal preferences.
User agent (UA)
A user agent is any program that interprets a document written in the document language and applies associated style sheets according to the terms of this specification. A user agent may display a document, read it aloud, cause it to be printed, convert it to another format, etc.
An HTML user agent is one that supports the HTML 2.x, HTML 3.x, or HTML 4.x specifications. A user agent that supports XHTML [XHTML10], but not HTML (as listed in the previous sentence) is not considered an HTML user agent for the purpose of conformance with this specification.

9.2. User agent conformance

[This section should contain rules for user style sheet conformance, author style sheet disabling, handling parsing errors, etc., from the CSS2.1 specification.]

[Below is the text from CSS2.1. Much of it needs rewriting given modularization. I've avoided substituting CSS3 where it's clearly not going to be appropriate.]

This section defines conformance with the CSS 2.1 specification only. There may be other levels of CSS in the future that may require a user agent to implement a different set of features in order to conform.

In general, the following points must be observed by a user agent claiming conformance to this specification:

  1. It must support one or more of the CSS3 media types.
  2. For each source document, it must attempt to retrieve all associated style sheets that are appropriate for the supported media types. If it cannot retrieve all associated style sheets (for instance, because of network errors), it must display the document using those it can retrieve.
  3. It must parse the style sheets according to this specification. In particular, it must recognize all at-rules, blocks, declarations, and selectors (see the grammar of CSS 2.1). If a user agent encounters a property that applies for a supported media type, the user agent must parse the value according to the property definition. This means that the user agent must accept all valid values and must ignore declarations with invalid values. User agents must ignore rules that apply to unsupported media types.
  4. For each element in a document tree, it must assign a value for every applicable property according to the property's definition and the rules of cascading and inheritance.
  5. If the source document comes with alternate style sheet sets (such as with the "alternate" keyword in HTML 4.0 [HTML40]), the UA must allow the user to select which style sheet set the UA should apply.

Not every user agent must observe every point, however:

The inability of a user agent to implement part of this specification due to the limitations of a particular device (e.g., a user agent cannot render colors on a monochrome monitor or page) does not imply non-conformance.

UAs must allow users to specify a file that contains the user style sheet. UAs that run on devices without any means of writing or specifying files are exempted from this requirement. Additionally, UAs may offer other means to specify user preferences, for example through a GUI.

CSS2.1 does not define which properties apply to form controls and frames, or how CSS can be used to style them. User agents may apply CSS properties to these elements. Authors are recommended to treat such support as experimental. A future level of CSS may specify this further.

9.2.1. Error conditions

In general, this document does not specify error handling behavior for user agents (e.g., how they behave when they cannot find a resource designated by a URI).

However, user agents must observe the rules for handling parsing errors.

Since user agents may vary in how they handle error conditions, authors and users must not rely on specific error recovery behavior.

9.3. Style sheet conformance

9.4. Authoring tool conformance

Authoring tools may use a modified form of the rules for handling parsing errors: when those rules require that user agents ignore something, authoring tools are not required to ignore it. However, authoring tools should not present such parts of the style sheet to the user in the same way as valid parts of the style sheet. In so far as authoring tools display the application of a style sheet to a document, they are required to meet the user agent conformance rules.

[informative reference to canonicalization proposal?]

10. Format of property definitions in other modules

Each CSS property definition begins with a summary of key information that resembles the following:

Value:   legal values & syntax
Initial:   initial value
Applies to:   elements this property applies to
Inherited:   whether the property is inherited
Computed Value:   the computed value of the property
Percentages:   how percentage values are interpreted
Media:   which media groups the property applies to

10.1. Value

This part specifies the set of valid values for the property. Value types may be designated in several ways:

  1. keyword values (e.g., auto, disc, etc.)
  2. basic data types, which appear between "<" and ">" (e.g., <length>, <percentage>, etc.). In the electronic version of the document, each instance of a basic data type links to its definition.
  3. types that have the same range of values as a property bearing the same name (e.g., <'border-width'> <'background-attachment'>, etc.). In this case, the type name is the property name (complete with quotes) between "<" and ">" (e.g., <'border-width'>). Such a type does not include the value 'inherit'. In the electronic version of the document, each instance of this type of non-terminal links to the corresponding property definition.
  4. non-terminals that do not share the same name as a property. In this case, the non-terminal name appears between "<" and ">", as in <border-width>. Notice the distinction between <border-width> and <'border-width'>; the latter is defined in terms of the former. The definition of a non-terminal is located near its first appearance in the specification. In the electronic version of the document, each instance of this type of value links to the corresponding value definition.

Other words in these definitions are keywords that must appear literally, without quotes (e.g., red). The slash (/) and the comma (,) must also appear literally.

Values may be arranged as follows:

Juxtaposition is stronger than the double bar, and the double bar is stronger than the bar. Thus, the following lines are equivalent:

    a b   |   c || d e
  [ a b ] | [ c || [ d e ]]

Every type, keyword, or bracketed group may be followed by one of the following modifiers:

The following examples illustrate different value types:

Value: N | NW | NE
Value: [ <length> | thick | thin ]{1,4}
Value: [<family-name> , ]* <family-name>
Value: <uri>? <color> [ / <color> ]?
Value: <uri> || <color>

See the values and units [CSS3VAL] module for the formal definitions of the basic values types.

[We need a more formal grammar for parsing of properties. Refer to section on keywords (they can't be quoted).]

10.1.1. initial and inherit values

In addition to the legal values stated, initial and inherit values are also legal for every property. The meaning of these values is described in the Values & Units [CSS3VAL] and Cascading & Inheritance [CSS3CASCADE] modules.

10.2. Initial

This part specifies the property's initial value. If the property is inherited, this is the value that is given to the root element of the document tree. Please consult the the Cascading & Inheritance module [CSS3CASCADE] for information about the interaction between style sheet-specified, inherited, and initial values.

10.3. Applies to

This part lists the elements to which the property applies. All elements are considered to have all properties, but some properties have no rendering effect on some types of elements. For example, 'white-space' only affects block-level elements.

10.4. Inherited

This part indicates whether the value of the property is inherited from an ancestor element by default ("Inherited: yes") or the value of the property is its initial value by default ("Inherited: no"). Please consult the Cascading & Inheritance Module [CSS3CASCADE] for information about the interaction between style sheet-specified, inherited, and initial values.

10.5. Computed value

This part indicates the computed value of the property. The concept of computed value is described in the Cascading & Inheritance Module [CSS3CASCADE]. (It is needed both for inheritance and for the definitions of some DOM properties.)

[What is the computed value for elements to which the property does not apply? Do some existing inherited properties rely on inheritance through elements to which the property doesn't apply?]

10.6. Percentage values

This part indicates how percentages should be interpreted, if they occur in the value of the property. If "N/A" appears here, it means that the property does not accept percentages as values.

10.7. Media groups

[Some of this needs to be relaxed to deal with profiles.]

This section is informative, not normative.

This part indicates the media groups for which the property must be implemented by a conforming user agent. Since properties generally apply to several media, the "Applies to media" section of each property definition lists media groups rather than individual media types. User agents must support the property if they support rendering to the media types included in these media groups. Each property applies to all media types in the media groups listed in its definition.

CSS3 defines the following media groups:

The following table shows the relationships between media groups and media types:

Relationship between media groups and media types
Media Types Media Groups
  continuous/paged visual/audio/speech/tactile grid/bitmap interactive/static
braille continuous tactile grid both
emboss paged tactile grid static
handheld both visual, audio, speech both both
print paged visual bitmap static
projection paged visual bitmap interactive
screen continuous visual, audio bitmap both
speech continuous speech N/A both
tty continuous visual grid both
tv both visual, audio bitmap both

10.8. Shorthand properties

Some properties are shorthand properties, meaning they allow authors to specify the values of several properties with a single property.

For instance, the 'font' property is a shorthand property for setting 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', and 'font-family' all at once.

The syntax of a shorthand property may allow some of the properties that can be specified by that shorthand to be omitted. When such values are omitted from a shorthand form, each "missing" property is assigned its initial value (see the Cascading & Inheritance module [CSS3CASCADE]). The definition of a shorthand property may further say that it resets the definitions of other properties to their initial value.

The multiple style rules of this example:

h1 { 
  font-weight: bold; 
  font-size: 2em;
  line-height: 1.2; 
  font-family: Helvetica, Arial, sans-serif; 
  font-variant: normal;
  font-style: normal;
  font-stretch: normal;
  font-size-adjust: none

may be rewritten with a single shorthand property:

h1 { font: bold 2em/1.2 Helvetica, Arial, sans-serif }

In this example, 'font-variant', 'font-stretch', 'font-size-adjust', and 'font-style' take their initial values.

11. Appendix: Second grammar

[This grammar was the Appendix D grammar of CSS2, augmented by the additions from the @namespace draft. It needs to be incorporated into the above normative text in some way.]

The grammar below defines the syntax of CSS2. It is in some sense, however, a superset of CSS2 as this specification imposes additional semantic constraints not expressed in this grammar. A conforming UA must also adhere to the forward-compatible parsing rules, the property and value notation, and the unit notation. In addition, the document language may impose restrictions, e.g. HTML imposes restrictions on the possible values of the "class" attribute.

11.1. Grammar

The grammar below is LL(1) (but note that most UA's should not use it directly, since it doesn't express the forward-compatible parsing conventions, only the CSS3 syntax). The format of the productions is optimized for human consumption and some shorthand notation beyond Yacc (see [YACC]) is used:

[It's probably not LL(1), but rather just LALR(1).]

[This needs a lot more revisions to reflect all the additions in CSS3.]

[This doesn't allow nested at-rules, such as @page inside @media. Do we want to allow this?]

The productions are:

  : [ CHARSET_SYM S* STRING S* ';' ]?
    [S|CDO|CDC]* [ import [S|CDO|CDC]* ]*
    [ namespace [S|CDO|CDC]* ]*
    [ [ ruleset | media | page | font_face ] [S|CDO|CDC]* ]*
    [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
  : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S*
  : MEDIA_SYM S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
  : IDENT S*
  : PAGE_SYM S* IDENT? pseudo_page? S*
    '{' S* declaration [ ';' S* declaration ]* '}' S*
  : ':' IDENT
    '{' S* declaration [ ';' S* declaration ]* '}' S*
  : '/' S* | ',' S* | /* empty */
  : '+' S* | '>' S* | /* empty */
  : '-' | '+'
  : IDENT S*
  : selector [ ',' S* selector ]*
    '{' S* declaration [ ';' S* declaration ]* '}' S*
  : simple_selector [ combinator simple_selector ]*
  : element_name? [ HASH | class | attrib | pseudo ]* S*
  : '.' IDENT
  : IDENT | '*'
  : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S*
    [ IDENT | STRING ] S* ]? ']'
  : ':' [ IDENT | FUNCTION S* IDENT S* ')' ]
  : property ':' S* expr prio?
  | /* empty */
  : term [ operator term ]*
  : unary_operator?
      TIME S* | FREQ S* | function ]
  | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor
  : FUNCTION S* expr ')' S*
 * There is a constraint on the color that it must
 * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])
 * after the "#"; e.g., "#000" is OK, but "#abcd" is not.
  : HASH S*

11.2. Lexical scanner

The following is the tokenizer, written in Flex (see [FLEX]) notation. The tokenizer is case-insensitive.

The two occurrences of "\377" represent the highest character number that current versions of Flex can deal with (decimal 255). They should be read as "\4177777" (decimal 1114111), which is the highest possible code point in Unicode/ISO-10646, except excluding the characters excluded in the nonascii production above.

%option case-insensitive

h		[0-9a-f]
nonascii	[\200-\377]
unicode		\\{h}{1,6}[ \t\r\n\f]?
escape		{unicode}|\\[ -~\200-\377]
nmstart		[a-z]|{nonascii}|{escape}
nmchar		[a-z0-9-]|{nonascii}|{escape}
string1		\"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
string2		\'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'

ident		[-]?{nmstart}{nmchar}*
name		{nmchar}+
num		[0-9]+|[0-9]*"."[0-9]+
string		{string1}|{string2}
url		([!#$%&*-~]|{nonascii}|{escape})*
w		[ \t\r\n\f]*
nl		\n|\r\n|\r|\f
range		\?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h})))))


[ \t\r\n\f]+		{return S;}

\/\*[^*]*\*+([^/][^*]*\*+)*\/	/* ignore comments */

"<!--"			{return CDO;}
"-->"			{return CDC;}
"~="			{return INCLUDES;}
"|="			{return DASHMATCH;}

{string}		{return 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;}
"@namespace"		{return NAMESPACE_SYM;}

"!{w}important"		{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}%			{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;}

Changes from CSS2

This section is informative.

The parts of CSS2 that have become part of this CSS3 draft are sections 1.3.2 (1.4.2 in CSS 2.1), 1.3.3 (1.4.3 in CSS2.1), 3 (parts), 4.1, 4.2, 4.4, and 6.3, 7, and Appendix D. This draft also contains new material on namespaces and on vendor extensions to CSS that began as separate documents.


Since most of this draft is taken from CSS2, it would not have been possible to write it so easily without the work of the editors and authors of [CSS1] and [CSS2]. This draft also borrows heavily from earlier drafts on CSS namespace support by Peter Linss [CSS3NAMESPACE] and early (unpublished) drafts on vendor extensions to CSS by Bert Bos. Many current and former members of the working group have contributed to this document. Discussions on www-style@w3.org and in other places have also contributed ideas to this specification. Comments from Glenn Adams, Björn Höhrmann, and Etan Wexler have been particularly helpful.


Normative references

Håkon Wium Lie. CSS3 module: Cascading and inheritance. 13 July 2001. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/2001/WD-css3-cascade-20010713
Håkon Wium Lie. CSS3 module: values and units. (forthcoming). W3C working draft. (Work in progress.)
Raggett, D.; Le Hors, A.; Jacobs, I.. HTML 4.0 Specification (revised). Apr 1998. W3C Recommendation. URL: http://www.w3.org/TR/1998/REC-html40-19980424
Fielding, Roy,; et al. Hypertext Transfer Protocol - HTTP/1.1. June 1999. Internet RFC 2616. URL: ftp://ftp.isi.edu/in-notes/rfc2616.txt
Information Technology - Universal Multiple- Octet Coded CharacterSet (UCS) - Part 1: Architecture and Basic Multilingual Plane. ISO/IEC10646-1:1993. The current specification also takes into consideration the first five amendments to ISO/IEC 10646-1:1993. Useful <a href="http://www.egt.ie/standards/iso10646/ucs-roadmap.html">roadmaps</a>show which scripts sit at which numeric ranges.
Information Processing -- Text and Office Systems -- Standard Generalized Markup Language (SGML). ISO 8879:1986.. URL: http://www.iso.ch/cate/d16387.html
N. Freed and N. Borenstein. Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies. November 1996. URL: http://www.ietf.org/rfc/rfc2045.txt
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. Internet RFC 2119. URL: http://www.ietf.org/rfc/rfc2119.txt
H. Lie, B. Bos, C. Lilley. The text/css Media Type. March 1998.. URL: http://www.ietf.org/rfc/rfc2318.txt
N. Freed; J. Postel. IANA Charset Registration Procedures. October 2000. Internet RFC 2978. URL: http://www.ietf.org/rfc/rfc2978.txt
Daniel Glazman; Tantek Çelik; Ian Hickson; et al. Selectors. 13 Nov 2001. W3C Candidate Recommendation. URL: http://www.w3.org/TR/2001/CR-css3-selectors-20011113
The Unicode Consortium. The Unicode Standard: Version 3.1.0. Addison Wesley Longman. 2000. ISBN 0-201-61633-5. For more information, consult the Unicode Consortium's home page at <a href="http://www.unicode.org/">http://www.unicode.org/</a> URL: http://www.unicode.org/unicode/standard/versions/enumeratedversions.html#Unicode_3_1_0

Other references

Characters sets. These are the official names for character sets that may be used in the Internet and may be referred to in Internet documentation URL: http://www.iana.org/assignments/character-sets
Håkon Wium Lie; Bert Bos. Cascading Style Sheets, level 1. 1996. W3C Recommendation. Revised 11 Jan 1999. URL: http://www.w3.org/TR/REC-CSS1
Bert Bos; Håkon Wium Lie; Chris Lilley; Ian Jacobs. Cascading Style Sheets, level 2. 1998. W3C Recommendation. URL: http://www.w3.org/TR/REC-CSS2
Håkon Wium Lie; Ian Hickson. CSS3 module: generated text. (forthcoming). W3C working draft. (Work in progress.)
Peter Linss. CSS Namespace Enhancements. 25 June 1999. W3C working draft. (Proposal) URL: http://www.w3.org/1999/06/25/WD-css3-namespace-19990625/
Robert Stevahn. CSS3 module: paged media. 28 Sep 1999. W3C working draft. (Work in progress) URL: http://www.w3.org/TR/1999/WD-css3-page-19990928
Dave Raggett; Daniel Glazman. CSS3 Speech Module. 14 May 2003. W3C working draft. (Work in progress.) URL: http://www.w3.org/TR/2003/WD-css3-speech-20030514
Tantek Çelik; Bert Bos; Marc Attinasi. Syntax of CSS rules in HTML's "style" attribute. 15 May 2002. W3C working draft. (Work in progress.) URL: http://www.w3.org/TR/2002/WD-css-style-attr-20020515
Flex: The Lexical Scanner Generator. Version 2.3.7, ISBN 1882114213
Håkon Wium Lie; Tantek Çelik; Daniel Glazman. Media queries. 23 January 2002. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/2002/CR-css3-mediaqueries-20020708
Steven Pemberton; et al. XHTML 1.0: The Extensible HyperText Markup Language. Jan 2000. W3C Recommendation. URL: http://www.w3.org/TR/2000/REC-xhtml1-20000126
Tim Bray; Jean Paoli; C. M. Sperberg-McQueen; Eve Maler. Extensible Markup Language (XML) 1.0 (Second Edition). Oct 2000. W3C Recommendation. URL: http://www.w3.org/TR/2000/REC-xml-20001006
J. Clark. Associating Style Sheets with XML documents. 29 June 1999. W3C Recommendation. URL: http://www.w3.org/TR/xml-stylesheet
S. C. Johnson. YACC - Yet another compiler compiler. Murray Hill. 1975. Technical Report.