CSS @charset rule
- Previous Page caret-color
- Next Page clear
Definition and usage
The @charset rule specifies the character encoding used in the stylesheet.
The @charset rule must be the first element in the stylesheet and cannot start with any character. If multiple @charset rules are defined, only the first one is used. The @charset rule cannot be used within a style attribute (on an HTML element) or within a <style> element related to the character set of the HTML page.
Example
Set the encoding of the stylesheet to Unicode UTF-8:
@charset "UTF-8";
CSS syntax
@charset "charset";
Attribute value
Value | Description |
---|---|
charset | Specifies the character encoding to be used. |
Browser support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
2.0 | 12.0 | 1.5 | 4.0 | 9.0 |
- Previous Page caret-color
- Next Page clear