Character Encoding of a Stylesheet

Description

The only thing that can come before an @import statement in a CSS stylesheet is an @charset statement.

@charset statement specifies the character encoding used by the stylesheet.

Example

The following code demonstrates how to specify the UTF-8 encoding.


@charset  "UTF-8";
@import "styles.css";
span  {
    border: medium black dashed;
    padding:  10px;
}

Note

If you don't specify a type of character encoding, the browser will use the encoding specified in the HTML document that loaded the stylesheet.

If there is no encoding specified for the HTML document, UTF-8 will be used by default.





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table