Export (0) Print
Expand All
Expand Minimize

2.2.1 [CSS-Level2-2009] Section 4.1.3, Characters and case


The specification states:

All CSS syntax is case-insensitive within the ASCII range (i.e., [a-z] and [A-Z] 
are equivalent), except for parts that are not under the control of CSS. For 
example, the case-sensitivity of values of the HTML attributes "id" and "class", of 
font names, and of URIs lies outside the scope of this specification. Note in 
particular that element names are case-insensitive in HTML, but case-sensitive in 

Quirks Mode (All Versions)

id, class, and attribute selector matching is case-insensitive and does not respect the HTML 4.01 case sensitivity.


The specification states:

In CSS, identifiers (including element names, classes, and IDs in selectors) can 
contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A1 and higher, 
plus the hyphen (-) and the underscore (_); they cannot start with a digit, or a 
hyphen followed by a digit. Identifiers can also contain escaped characters and any 
ISO 10646 character as a numeric code (see next item). For instance, the identifier 
"B&W?" may be written as "B\&W\?" or "B\26 W\3F".

Quirks Mode and IE7 Mode (All Versions)

Attribute selectors can begin with digits.


The specification states:

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).

Quirks Mode and IE7 Mode (All Versions)

Strings with escaped newline characters are not treated as single whole strings.


The specification states:

Third, backslash escapes allow authors to refer to characters they cannot 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 ([ISO-10646]) 
character with that number, which must not be zero. (It is undefined in CSS 2.1 
what happens if a style sheet does contain a character with Unicode codepoint 
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:
1. with a space (or other white space character): "\26 B" ("&B"). In this case, 
user agents should treat a "CR/LF" pair (U+000D/U+000A) as a single white space 

2. by providing exactly 6 hexadecimal digits: "\000026B" ("&B")

In fact, these two methods may be combined. Only one white space 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.

Quirks Mode and IE7 Mode (All Versions)

Escaped character sequences (less than six hex digits) that are terminated by tabs and line feed characters are not supported.

© 2014 Microsoft