@charset Rule - HTML CSS CSS Property

HTML CSS examples for CSS Property:charset Rule

Description

@charset rule is used in an external sheet to specify the character encoding of the style rules and values.

@charset rule should not be used in an embedded style sheet, since character encoding in HTML is defined by <meta> tag.

Only one @charset rule may appear in an external style sheet.

@charset rule must not be preceded by any characters, not even comments.

Syntax

The syntax of this at-rule is as follows:

@charset "charset-name";

The example below shows the @charset property.

Example

@charset "UTF-8";
/* CSS Document */
body {
    background: yellow;
}

Related Tutorials