@charset
The @charset CSS at-rule specifies the character encoding of an external style sheet.
Overview
The @charset CSS at-rule specifies the character encoding of an external style sheet.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 2 | 12 | 1.5 | 4 | 18 | 4 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
- Firefox 1 supported an invalid syntax where the character encoding is not between single or double quotes.
Syntax
CSS
@charset "UTF-8";
body {
font-family: sans-serif;
} Live demo
Use cases
Using @charset
The @charset CSS at-rule specifies the character encoding of an external style sheet.
Cautions
- May not be supported in older browsers.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.
Related links
Powered by web-features