text: Contents
  This section describes a grammar (and forward-compatible parsing rules) common to any version of CSS (including CSS 2.1). Future versions of CSS will adhere to this core syntax, although they may add additional syntactic constraints.
  These descriptions are normative. They are also complemented by the normative grammar rules presented in Appendix G..
  At the lexical level, CSS style sheets consist of a sequence of tokens. The list of tokens for CSS 2.1 is as follows. The definitions use Lex-style regular expressions. Octal codes refer to ISO 10646 ([ISO10646]). As in Lex, in case of multiple matches, the longest match determines the token.
  The macros in curly braces ({}) above are defined as follows:
  Below is the core syntax for CSS. The sections that follow describe how to use it. Appendix G describes a more restrictive grammar that is closer to the CSS level 2 language.
  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 : DELIM? property S* ':' S* value; property : IDENT; value : [ any | block | ATKEYWORD S* ]+; any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES | DASHMATCH | FUNCTION S* any* ')' | '(' S* any* ')' | '[' S* any* ']' ] S*;
  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..
  The2.1,.
  This section is informative.
  At the time of writing, the following prefixes are known to exist:
  Vendor/organization specific extensions should be avoided.
  The following rules always hold:
  Note that Unicode is code-by-code equivalent to ISO 10646 (see [UNICODE] and [ISO10646]).
  First, inside a string, a backslash followed by a newline is ignored (i.e., the string is deemed not to contain either the backslash or the newline)..
  Third, backslash escapes allow authors to refer to characters they can't easily put in a document. In this case, the backslash is followed by at most six hexadecimal digits (0..9A..F), which stand for the ISO 10646 ([ISO10646]) character with that number, which must not be zero. If a character in the range [0-9a-fA-F] follows the hexadecimal number, the end of the number needs to be made clear. There are two ways to do that:
  In fact, these two methods may be combined. Only one whitespace character is ignored after a hexadecimal escape. Note that this means that a "real" space after the escape sequence must itself either be escaped or doubled.
  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.
  In this specification, the expressions "immediately before" or "immediately after" mean with no intervening whitespace or comments.
  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 at-rule must ignore the whole of the at-rule and continue parsing after it.CSS 2.1 user agents must ignore any '@import' rule that occurs inside a block or that doesn't precede all rule sets.
  Assume, for example, that a CSS 2.1 parser encounters this style sheet:
  @import "subs.css"; h1 { color: blue } @import "list.css";
  The second '@import' is illegal according to CSS2.1. The CSS 2.1 parser ignores ({ }) 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 CSS 2.1, but it is still a block as defined above. (see also the section on selectors) 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 CSS 2.1), it must ignore the {}-block as well.
  CSS 2.1 2.1.
  For example, since the "&" is not a valid token in a CSS 2.1 selector, a CSS 2.1 user agent valid CSS 2.1
  statement.
  p[example="public class foo\ {\ private int x;\ \ foo(int x) {\ this.x = x;\ }\ \ }"] { color: red }
  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. is an identifier. Any character may occur in the, and colors.
  A user agent must ignore a declaration with an invalid property name or an invalid value. Every CSS 2.1 property has its own syntactic and semantic restrictions on the values it accepts.
  For example, assume a CSS 2.1 parser encounters this style sheet:
  h1 { color: red; font-style: 12pt } /* Invalid value: 12pt */ 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 CSS 2.1 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.0 specification ([HTML40]) for more information. } }
  How
  to
  handle unparseable
  and untokenizable stylesheetsis undefined in CSS2.1.
  Note that many properties that allow an integer or real number as a value actually restrict the value to some range, often to a non-negative value.
  Lengths refer to horizontal or vertical measurements.
  The format of a length value (denoted by <length> in this specification) is a <number> (with or without a decimal point) immediately followed by a unit identifier (e.g., px, em, etc.). After a zero length, the unit identifier is optional.
  Some properties allow negative length values, but this may complicate the formatting model and there may be implementation-specific limits. If a negative length value cannot be supported, it should be converted to the nearest value that can be supported.
  If a negative length value is set on a property that does not allow negative length values, the declaration is ignored.
  There are two types of length units: relative and absolute. Relative length units specify a length relative to another length property. Style sheets that use relative units will more easily scale from one medium to another (e.g., from a computer display to a laser printer).
  Relative units are:
  h1 { margin: 0.5em } /* em */ h1 { margin: 1ex } /* ex */ p { font-size: 12px } /* px */.)
  The 'ex' unit is defined by the font's 'x-height'. The x-height is so called because it is often equal to the height of the lowercase "x". However, an 'ex' is defined even for fonts that don't contain an "x".
  The rule:
  h1 { line-height: 1.2em }
  means that the line height of "h1" elements will be 20% greater than the font size of the "h1" elements. On the other hand:
  h1 { font-size: 1.2em }
  means that the font-size of "h1" elements will be 20% greater than the font size inherited by "h1" elements.
  When specified for the root of the document tree (e.g., "HTML" in HTML), 'em' and 'ex' refer to the property's initial value.). When printed on a laser printer, meant for reading at a little less than arm's length (55 cm, 21 inches), 1px is about 0.20 mm. cm (28 inch).
  In the following rules, the computed 'text-indent' value of "h1" elements will be 36px, not 45px, if "h1" is a child of the "body" element.
  body { font-size: 12px; text-indent: 3em; /* i.e., 36px */ } h1 { font-size: 15px }
  Absolute length units are only useful when the physical properties of the output medium are known. The absolute unitsLs (Uniform Resource
  Locators, see [RFC1738] and [RFC1808] )
  provide the address of a resource on
  the Web. Another way of identifying resources is called URN (Uniform Resource Name). Together they are
  called URIs (Uniform Resource
  Identifiers, see [URI]). This specification uses the term URI.
  URI values in this specification are denoted by <uri>. The functional notation used to designate URIs in property values is "url()", as in: ')'. The two quote characters must be the same.
  An example without quotes:
  li { list-style: url() disc }
  parentheses,
  commas, whitespace characters, single quotes (') and double quotes
  (") appearing in an unquoted URI must be escaped with a backslash: '\(', '\)', '\,'.
  Depending on the type of URI, it might also be possible to write the above characters as URI-escapes (where "(" = %28, ")" = %29, etc.) as described in [URI]..
  For example, suppose the following rule:
  body { background: url("yellow") }
  is located in a style sheet designated by the URI:
  The background of the source document's BODY will be tiled with whatever image is described by the resource designated by the URI
  User agents may vary in how they handle invalid URIs or URIs that designate unavailable or inapplicable resources.
  Counters are denoted by identifiers (see the 'counter-increment' and 'counter-reset' properties). To refer to the value of a counter, the notation 'counter(<identifier>)' or 'counter(<identifier>, <list-style-type>)' is used. The default style is 'decimal'.
  To refer to a sequence of nested counters of the same name, the notation is 'counters(<identifier>, <string>)' or 'counters(<identifier>, <string>, <list-style-type>)'. See "Nested counters and scope" in the chapter on generated content.
  In CSS2,) ". "}
  Counters that are not in the scope of any 'counter-reset', are assumed to have been reset to 0 by a 'counter-reset' on the root element.
  A <color> is either a keyword or a numerical RGB specification.
  The list of keyword color names.. Whitespace]).
  Conforming user agents may limit their color-displaying efforts to performing a gamma-correction on them. sRGB specifies a display gamma of 2.2 under specified viewing conditions. User agents should.
  Values outside the device gamut should be clipped: the red, green, and blue values must be changed to fall within the range supported by the device. clipped. Unicode (U+000A), such as "\A" or "\00000a". This character represents the generic notion of "newline" in CSS. See the 'content' property for an example.
  It is possible to break strings over several lines, for esthetic stylesheets,.0 specification ([HTML40], chapter 5), See also the XML 1.0 specification ([XML10], sections 2.2 and 4.3.3, and Appendix style sheet's character encoding (from highest priority to lowest):
  <link charset="">or other metadata from the linking mechanism (if any)
  At most one @charset rule may appear in an external style sheet and itmust
  appear at the very start of the style sheet, notpreceded by
  any characters, except possibly a "BOM" (U+FEFF). Any other @charset rules must be ignored by the UA.
  After
  "@charset", authors specify
  the name of a character encoding (in quotes). For example:
  @charset "ISO-8859-1";
  The name must be a charset name as described in the IANA registry. See [CHARSETS] for a complete list of charsets. Authors should use the charset names marked as "preferred MIME name" in the IANA registry.
  This specification does not mandate which character encodings aUser agent must support. This specification does not specify what algorithm a UA
  must
  apply to derive
  the encoding from the
  BOM and the @charset.
  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], Unicode>