CSS Escape Notation

If you need to use characters that aren’t easily inserted with a keyboard, or can’t be represented through the style sheet’s character encoding, specify them in an external style sheet using CSS Escape Notation. Representing escaped characters in CSS is quite different from the process we use in HTML.

The character escape sequence consists of a backslash character (\) followed by between one and six hexadecimal digits that represent a character code from the ISO 10646 standard (which is equivalent to Unicode, for all intents and purposes). Any character other than a hexadecimal digit will terminate the escape sequence.

If a character following the escape sequence is also a valid hexadecimal digit, you must either include six digits in the escape, or use a whitespace character to terminate the escape.

For example, if we wanted to output the string value "»back" (producing a chevron immediately adjacent to the word “back”), we’d need to use either "\0000bbback" or "\bb back" (0x00bb is the ISO 10646 code for the chevron character).

This also means that one whitespace character after an escape sequence will always be ignored—even if it appears after an escape sequence that uses six digits. If you want to include a whitespace character as part of the string, you’ll need to double the whitespace.

Let’s modify our previous example. If we wanted to output the string value "» back" (displaying a chevron, followed by a space, followed by the word “back”), we’d need to use either "\0000bb  back" or "\bb  back". In both cases, two spaces appear between the escape sequence and the word “back.”

User-contributed notes

by HarveyP
Thu, 18 Sep 2008 21:16:22 GMT
This note has not yet been confirmed for accuracy and relevance.

It would be useful to link to a UniCode/value pair listing here (I can't help, worse luck) ... so that we can find the reverse chevron for open quotes in French (to match the close quotes chevron).

Related Products