Jitendra Vyas
Jitendra Vyas

Reputation: 152667

What is the benefit to add @charset "ISO-8859-15"; at top in css file?

What is the benefit to add @charset "ISO-8859-15"; or @charset "utf-8"; at top in css?

Upvotes: 3

Views: 541

Answers (2)

Isley Aardvark
Isley Aardvark

Reputation: 256

It's unnecessary. The css file will use the encoding specified in the HTML document that calls it, and an HTML page needs to specify the charset to be valid. You would only need it in rare cases where you want a different encoding for your CSS.

Upvotes: 1

Brian Agnew
Brian Agnew

Reputation: 272267

It specifies the character encoding of that CSS file, and thus how the browser should read it (strictly, how the browser should interpret the bytes making up that CSS file into characters and thus strings).

EDIT: Obligatory link to Joel Spolsky's character encoding article included, to clarify any issues on encodings.

Upvotes: 4

Related Questions