Specifying the Character Encoding of a Stylesheet

@charset specifies the character encoding for the stylesheet. @charset can be set before an @import statement in a CSS stylesheet.


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

The browser uses the encoding specified in the HTML document to load the stylesheet if you don't specify a type of character encoding.

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

Home 
  HTML CSS Book 
    CSS  

Introduction:
  1. What is Cascading Style Sheets (CSS)
  2. Adding Styles to HTML
  3. Specifying the Character Encoding of a Stylesheet
  4. How Styles Cascade and Inherit
  5. Element Classification
  6. Cascading Style Sheets prefixes for the most popular browsers
Related: