CSS @charset rule
Example
Set the character encoding used in the style sheet to UTF-8:
@charset
"
UTF-8
";
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| @charset | 2.0 | 12.0 | 1.5 | 4.0 | 9.0 |
Property definition and usage
The @charset rule specifies the character encoding used in a style sheet file (with a .css suffix), and can only be used in CSS files.
It must be the first element in the style sheet and must not be preceded by any characters.
If multiple @charset rules are declared, only the first one is used, and it cannot be used in HTML elements or in HTML pages, that is, it cannot be in