CSS @charset Property

CSS @charset Property

 

CSS @charset Property


@charset rule specifies the character encoding of the style rules and values. The @charset rule should never be used in an embedded style sheet, as there are other ways to define character encoding in HTML such as <meta> tag. If several @charset at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an HTML element or inside the <style> element where the HTML page's character set is relevant.

Initial Valuenone
Applies toBlock-level elements.
InheritedNo.
AnimatableNo.
VersionCSS2
DOM Syntaxobject.style.clear = "UTF-8";

Syntax

@charset "charset";

Here you can see how @charset can be used in code:

@charset "iso-8859-15";       /* Set the encoding of the style sheet to iso-8859-15*/

The following piece of code shows both the right and wrong ways of using the @charset rule: 

@charset "UTF-8";       /* Set the encoding of the style sheet to Unicode UTF-8 */
@charset 'iso-8859-15'; /* Invalid, wrong quoting style used */
@charset  "UTF-8";      /* Invalid, more than one space */
 @charset "UTF-8";      /* Invalid, there is a character (a space) before the at-rule */
@charset UTF-8;         /* Invalid, without ' or "*/

Values

ValueDescription
charsetSpecifies the character encoding to use.
initialIt makes the property use its default value.
inheritIt inherits the property from its parent's element.
Soeng Souy

Soeng Souy

Website that learns and reads, PHP, Framework Laravel, How to and download Admin template sample source code free.

Post a Comment

CAN FEEDBACK
close