CSS2 » Other » @charset

Version: Level 2

Compability: IE5+  N6+

Syntax:
@charset "charset";

The @charset at-rule allows you to designate a character set be used with an HTML document.

Note that the @charset at-rule can ONLY appear in an external style sheet file. It cannot appear inside a style element embedded inside an HTML document.
 
The W3C officially defines the character sets at:
http://www.iana.org/assignments/character-sets.
 
The syntax for an at-rule is an @ symbol, followed immediately by an unique identifier, which in turn is followed by the block which contains content that is applied on a document level. The block syntax is either:

  • all content contained between a pair of curly brackets,
  • or is all content contained between the unique identifier and a semi-colon.
There are five at-rules: @charset, @font-face, @import. @media, and @page.
 
The mandatory charset component is the name of the character set enclosed between a pair of double quotes.

Examples

Code:
@charset "ISO-8859-6"
Explanation:

This example shows how the character set for Arabic is designsted.

Language(s): CSS2

See Also: