Skip to content

[selectors-5]: Update heading specs based on resolutions in #10296 #12404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions selectors-5/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ Heading Structures: the heading pseudo-classes '':heading'', and '':heading()''<
matches an element which has a <a>heading level</a>, with respect to the
semantics defined by the document language (e.g. [[HTML5]]).

The [=specificity=] of '':heading'' is that of a class.

<div class="example">
For example, the following sheet contains a rule applying to all heading
elements in the current page:
Expand All @@ -170,16 +172,26 @@ Heading Structures: the heading pseudo-classes '':heading'', and '':heading()''<
</div>

As a functional pseudo-class,
<dfn id='heading-functional-pseudo' lt=':heading()'>:heading(<var>An+B</var>)</dfn>
<dfn id='heading-functional-pseudo' lt=':heading()'>:heading()</dfn>
notation represents elements that have a <a>heading level</a> among <var>An+B</var>.
The syntax is:

<pre class=prod>
::heading() = ::heading( <<An+B>># )
</pre>

The [=specificity=] of '':heading()'' is that of a class.

<div class="example">
The following example styles headings with levels between 1 and 3 with a
font-weight of 900, while headings with levels 6 onward with font-weight of
500:
500, additionally heading levels 1 and 2 will be underlined, while 3 and
beyond will have no text-decoration:

<pre>:heading(-n+3) { font-weight: 900; }</pre>
<pre>:heading(n+6) { font-weight: 500; }</pre>
<pre>:heading(1, 2) { text-decoration: underline; }</pre>
<pre>:heading(n+3) { text-decoration: none; }</pre>
</div>

Note: The <a>heading level</a> might be different from an element's
Expand Down