@@ -16,6 +16,7 @@ Abstract: Selectors Level 5 describes the selectors that already exist in [[!sel
1616<pre class="link-defaults">
1717spec:selectors-4; type:dfn; text:selector
1818spec:html; type:dfn; text:states set
19+ spec:html; type:dfn; text:heading level
1920</pre>
2021
2122<h2 id="intro">
@@ -154,6 +155,37 @@ Exposing custom state: the '':state()'' pseudo-class</h2>
154155 see <a href="https://html.spec.whatwg.org/multipage/custom-elements.html#custom-state-pseudo-class">HTML's definition</a> for more detail.
155156 Other host languages must define how this pseudo-class matches.
156157
158+ <h2 id="headings">
159+ Heading Structures: the heading pseudo-classes '':heading'', and '':heading()''</h2>
160+
161+ The (non-functional) <dfn id='heading-pseudo'>:heading</dfn> pseudo-class
162+ matches an element which has a <a>heading level</a> , with respect to the
163+ semantics defined by the document language (e.g. [[HTML5]] ).
164+
165+ <div class="example">
166+ For example, the following sheet contains a rule applying to all heading
167+ elements in the current page:
168+
169+ <pre> :heading { text-decoration: underline; }</pre>
170+ </div>
171+
172+ As a functional pseudo-class,
173+ <dfn id='heading-functional-pseudo' lt=':heading()'>:heading(<var>An+B</var>)</dfn>
174+ notation represents elements that have a <a>heading level</a> among <var> An+B</var> .
175+
176+ <div class="example">
177+ The following example styles headings with levels between 1 and 3 with a
178+ font-weight of 900, while headings with levels 6 onward with font-weight of
179+ 500:
180+
181+ <pre> :heading(-n+3) { font-weight: 900; }</pre>
182+ <pre> :heading(n+6) { font-weight: 500; }</pre>
183+ </div>
184+
185+ Note: The <a>heading level</a> might be different from an element's
186+ <a>type selector</a> . Thus, a selector ''h1:heading(3)'' matches any
187+ ''h1'' tag which has an exposed heading level of 3.
188+
157189<h2 id="combinators">
158190Combinators</h2>
159191
@@ -202,6 +234,7 @@ Changes Since Level 4</h3>
202234 <li> The functional form of the '':local-link'' pseudo-class
203235 (deferred from an <a href="https://www.w3.org/TR/2013/WD-selectors4-20130502/">earlier draft</a> of Selectors 4)</li>
204236 <li> The '':state()'' pseudo-class</li>
237+ <li> The '':heading'' and '':heading()'' pseudo-classes</li>
205238 </ul>
206239
207240<h2 id="acknowledgements">
0 commit comments