Prev | Current Page 89 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"

The at-rule must be followed
by a quoted string value and a
semicolon; the string must contain a
valid encoding name from the IANA
registry.1
SPEC
CSS2
BROWSER SUPPORT
Op9.2+ Saf3 FF1.5+ IE5.5+
FULL NONE FULL BUGGY
Example
This example indicates that the style sheet
will use the ISO-8859-15 character
encoding:
@charset "ISO-8859-15";
For obvious reasons, if it??™s present, an
@charset rule must be the very first thing in the CSS file. The only item that can
precede it is a Unicode byte order mark (BOM).2
You??™ll rarely need to use an @charset rule in your style sheets. A user agent can
deduce the character encoding of a CSS style sheet in four different ways, and if all
of those fail, it uses a default.
For an external style sheet, a user agent will look for the following items:
?–  a charset attribute in a Content-Type HTTP header (or similar) sent by the web
server
?–  a Unicode byte order mark, or an @charset at-rule
?–  a charset attribute specified in the tag from which the HTML document
links to the style sheet
?–  the encoding of the referring document or style sheet
This list defines the items in order of descending priority, and the first one that??™s
found will determine the style sheet??™s encoding.


Pages:
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101