You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The <code><an+b></code> type</a></ul><li><ahref=#rule-defs><spanclass=secno>7</span>
117
117
Defining Grammars for Rules and Other Values</a><ulclass=toc><li><ahref=#declaration-rule-list><spanclass=secno>7.1</span>
118
-
Defining Block Contents: the <var><declaration-list></var>, <var><rule-list></var>, and <var><stylesheet></var> productions</a></ul><li><ahref=#serialization><spanclass=secno>8</span>Serialization</a><ulclass=toc><li><ahref=#serializing-anb><spanclass=secno>8.1</span>
119
-
Serializing <var><an+b></var></a></ul><li><ahref=#changes><spanclass=secno>9</span>Changes from CSS 2.1 and Selectors Level 3</a><li><ahref=#acknowledgments><spanclass=secno></span>
118
+
Defining Block Contents: the <var><declaration-list></var>, <var><rule-list></var>, and <var><stylesheet></var> productions</a></ul><li><ahref=#css-stylesheets><spanclass=secno>8</span>CSS stylesheets</a><ulclass=toc><li><ahref=#style-rules><spanclass=secno>8.1</span>Style rules</a><li><ahref=#charset-rules><spanclass=secno>8.2</span><spanclass=cssdata-autolink=maybe>@charset</span> rules</a><li><ahref=#other-at-rules-rules><spanclass=secno>8.3</span>Other at-rules rules</a></ul><li><ahref=#serialization><spanclass=secno>9</span>Serialization</a><ulclass=toc><li><ahref=#serializing-anb><spanclass=secno>9.1</span>
119
+
Serializing <var><an+b></var></a></ul><li><ahref=#changes><spanclass=secno>10</span>Changes from CSS 2.1 and Selectors Level 3</a><li><ahref=#acknowledgments><spanclass=secno></span>
<dfndata-dfn-type=linkid=style-rules0title="style rule|style rules">Style rules</dfn> are <ahref=#qualified-rule>qualified rules</a>
2703
+
that associate a <ahref=http://dev.w3.org/csswg/selectors4/#selector-list>selector list</a><adata-autolink=bibliodata-biblio-type=normativehref=#selecttitle=SELECT>[SELECT]</a>
2704
+
with a list of property declarations.
2705
+
They are also called
2706
+
<ahref=http://www.w3.org/TR/CSS21/syndata.html#rule-sets>rule sets</a> in <adata-autolink=bibliodata-biblio-type=normativehref=#css21title=CSS21>[CSS21]</a>.
2707
+
CSS Cascading and Inheritance <adata-autolink=bibliodata-biblio-type=normativehref=#css3cascadetitle=CSS3CASCADE>[CSS3CASCADE]</a> defines how style rules participate in the cascade.
A style rule with an invalid selector is invalid: the whole rule is ignored.
2713
+
2714
+
<p>
2715
+
The content of the qualified rule’s block is parsed as a
2716
+
<ahref=#parse-a-list-of-declarations0title="parse a list of declarations">list of declarations</a>.
2717
+
Unless defined otherwise by another specification or a future level of this specification,
2718
+
at-rules in that list are invalid.
2719
+
Declaration for an unknown CSS property
2720
+
or whose value does not match the syntax defined by the property are invalid.
2721
+
Invalid declarations or at-rules are ignored with a <ahref=#parse-errors>parse error</a>,
2722
+
they do not make the rule invalid.
2723
+
Unless otherwise specified, property names are <ahref=#ascii-case-insensitive>ASCII case-insensitive</a>.
2724
+
2725
+
<pclass=note>
2726
+
The name of Custom Properties <adata-autolink=bibliodata-biblio-type=informativehref=#css-variablestitle=CSS-VARIABLES>[CSS-VARIABLES]</a> is case-sensitive.
2727
+
2728
+
<p>
2729
+
<ahref=#qualified-rule>Qualified rules</a> at the top-level of a CSS stylesheet are style rules.
2730
+
Qualified rules in other contexts may or may not be style rules,
2731
+
as defined by the context.
2732
+
2733
+
<pclass=note>
2734
+
For example qualified rules inside <spanclass=cssdata-autolink=maybe>@media</span> rules <adata-autolink=bibliodata-biblio-type=informativehref=#css3-conditionaltitle=CSS3-CONDITIONAL>[CSS3-CONDITIONAL]</a> are style rules,
2735
+
but not they’re not inside <spanclass=cssdata-autolink=maybe>@keyframes</span> rules <adata-autolink=bibliodata-biblio-type=informativehref=#css3-animationstitle=CSS3-ANIMATIONS>[CSS3-ANIMATIONS]</a>.
<dfndata-dfn-type=at-ruleid=charset-rules0><spanclass=cssdata-autolink=maybe>@charset</span> rules</dfn> are <ahref=#at-rule>at-rules</a> whose name is an <ahref=#ascii-case-insensitive>ASCII case-insensitive</a> match for "charset".
2742
+
2743
+
<p>
2744
+
An <spanclass=cssdata-autolink=maybe>@charset</span> rule is invalid if it is not at the top-level of a stylesheet,
2745
+
if it is not the very first rule of a stylesheet,
2746
+
or if does not match the following <ahref=#rule-defs>grammar</a>:
Other specifications may define specific types of at-rules based on their name.
2781
+
Such definitions must include what contexts a given type of at-rule is valid in.
2782
+
At-rules of unknown type are invalid.
2783
+
2784
+
<pclass=example>
2785
+
<spanclass=cssdata-autolink=maybe>@import</span> rules <adata-autolink=bibliodata-biblio-type=informativehref=#css3cascadetitle=CSS3CASCADE>[CSS3CASCADE]</a> must be at the top-level of a stylesheet,
2786
+
after <spanclass=cssdata-autolink=maybe>@charset</span> rules, and before any other rules.
2787
+
2788
+
<pclass=example>
2789
+
Margin rules <adata-autolink=bibliodata-biblio-type=informativehref=#css3pagetitle=CSS3PAGE>[CSS3PAGE]</a> must be directly inside a <spanclass=cssdata-autolink=maybe>@page</span> rule.
<h2data-level=9id=changes><spanclass=secno>9</span><spanclass=content>Changes from CSS 2.1 and Selectors Level 3</span><aclass=section-linkhref=#changes>§</a></h2>
2870
+
<h2data-level=10id=changes><spanclass=secno>10</span><spanclass=content>Changes from CSS 2.1 and Selectors Level 3</span><aclass=section-linkhref=#changes>§</a></h2>
<divdata-fill-with=normative-references><dl><dtid=rfc2119title=RFC2119>[RFC2119]<dd>S. Bradner. <ahref=http://www.ietf.org/rfc/rfc2119.txt>Key words for use in RFCs to Indicate Requirement Levels</a>. URL: <ahref=http://www.ietf.org/rfc/rfc2119.txt>http://www.ietf.org/rfc/rfc2119.txt</a></dl></div>
3149
+
<divdata-fill-with=normative-references><dl><dtid=css21title=CSS21>[CSS21]<dd>Bert Bos; et al. <ahref=http://www.w3.org/TR/2011/REC-CSS2-20110607/>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. W3C Recommendation. URL: <ahref=http://www.w3.org/TR/2011/REC-CSS2-20110607/>http://www.w3.org/TR/2011/REC-CSS2-20110607/</a><dtid=css3cascadetitle=CSS3CASCADE>[CSS3CASCADE]<dd>Håkon Wium Lie; Elika J. Etemad; Tab Atkins Jr.. <ahref=http://www.w3.org/TR/2013/WD-css3-cascade-20130103/>CSS Cascading and Inheritance Level 3</a>. 3 January 2013. W3C Working Draft. (Work in progress.) URL: <ahref=http://www.w3.org/TR/2013/WD-css3-cascade-20130103/>http://www.w3.org/TR/2013/WD-css3-cascade-20130103/</a><dtid=rfc2119title=RFC2119>[RFC2119]<dd>S. Bradner. <ahref=http://www.ietf.org/rfc/rfc2119.txt>Key words for use in RFCs to Indicate Requirement Levels</a>. URL: <ahref=http://www.ietf.org/rfc/rfc2119.txt>http://www.ietf.org/rfc/rfc2119.txt</a><dtid=selecttitle=SELECT>[SELECT]<dd>Tantek Çelik; et al. <ahref=http://www.w3.org/TR/2011/REC-css3-selectors-20110929/>Selectors Level 3</a>. 29 September 2011. W3C Recommendation. URL: <ahref=http://www.w3.org/TR/2011/REC-css3-selectors-20110929/>http://www.w3.org/TR/2011/REC-css3-selectors-20110929/</a></dl></div>
0 commit comments