@charset

在外部样式表文件内使用。指定该样式表使用的字符编码。该规则后面的分号是必需的,如果省略了此分号,会生成错误信息。

 

语法

@charset <charset>;

参数

  • charset
    字符集名称。

描述
<charset> 字符编码。如:@charset “utf-8”。

例子

@charset "UTF-8";       /* Set the encoding of the style sheet to Unicode UTF-8 */
@charset 'iso-8859-15'; /* Invalid, wrong quoting style used */
@charset  "UTF-8";      /* Invalid, more than one space */
@charset "UTF-8";      /* Invalid, there is a character (a space) before the at-rule */
@charset UTF-8;         /* Invalid, without ' or ", the charset is not a CSS <string> */

参考

相关页面

外部链接