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
HTML CSS Book
CSS
Introduction:
- What is Cascading Style Sheets (CSS)
- Adding Styles to HTML
- Specifying the Character Encoding of a Stylesheet
- How Styles Cascade and Inherit
- Element Classification
- Cascading Style Sheets prefixes for the most popular browsers
Related: