Candidate Recommendation Draft · css-syntax

CSS Syntax

1 at-rule, 1 type defined by this specification, 1 of them known to at least one browser (the others are badged Not in any browser yet).

Each feature in detail

@charset

At-rule Baseline: widely availablesince January 2018

Spec However, there is no actual at-rule named @charset. When a stylesheet is actually parsed, any occurrences of an @charset rule must be treated as an unrecognized rule, and thus dropped as invalid when the stylesheet is grammar-checked.

MDN The @charset CSS rule specifies the character encoding used in the style sheet. This syntax is useful when using non-ASCII characters in some CSS properties, like content. Although the first character in @charset is the @ symbol, it is not an at-rule. It is a specific byte sequence that can only be placed at the very beginning of a stylesheet. No other characters, except the Unicode byte-order mark, are allowed before it. It also does not follow normal CSS syntax rules such as use of quotes or whitespace.

Browser support

First browser version supporting @charset
Chrome 2
Edge 12
Firefox 1.5
Safari 4
Chrome Android 18
Safari iOS 4

First version with support, from MDN browser-compat-data.

<rule-list>

Type Not in any browser yet

Spec <rule-list>: qualified rules and at-rules are allowed; declarations are automatically invalid.

MDN The <rule-list> CSS data type represents a sequence of zero or more CSS rules. It is used to define places in CSS where multiple rules may appear, such as the top level of a stylesheet or inside grouping at-rules like @media or @supports.