Skip to content

Conversation

keithamus
Copy link
Member

This fixes #10296, #351, #1008 by specifying the :heading and :heading(An+B) pseudo classes, which will match against elements with a defined heading level. As it stands, the current elements with a heading level are h1, h2, h3, h4, h5, and h6.

There is a proposal being actively prototyped to allow for more dynamic heading levels that do not strictly adhere to their tagname (see whatwg/html#5033 for more). This proposal (adding the headingoffset, headingreset attributes) will make it significantly more complex to unilaterally style elements with a heading level of, say, 1, raising the importance of the selectors proposed in this PR.

I've Agenda+ the issue #10296 in order to discuss this, the proposed selectors, that we may resolve and merge this PR, but in the meantime I would appreciate editorial review from those that have time.

@keithamus keithamus requested a review from tabatkins March 5, 2025 18:14
@keithamus keithamus changed the title [css-selectors-5] add :heading, :heading() pseudo classes [css-selectors-5] add :heading, :heading(An+B) pseudo classes Mar 5, 2025
@keithamus keithamus merged commit 4c4b37a into w3c:main Jun 27, 2025
1 check passed
@keithamus keithamus deleted the add-heading-heading-pseudo-classes branch June 27, 2025 08:29
@annevk
Copy link
Member

annevk commented Jun 27, 2025

This should really have had a corresponding HTML PR. Will one be created?

zcorpan added a commit to web-platform-tests/wpt that referenced this pull request Jun 27, 2025
zcorpan added a commit to web-platform-tests/wpt that referenced this pull request Aug 11, 2025
foolip pushed a commit to web-platform-tests/wpt that referenced this pull request Aug 13, 2025
lando-prod-mozilla bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Aug 19, 2025
…, a=testonly

Automatic update from web-platform-tests
[selectors] Test :heading and :heading()

See w3c/csswg-drafts#11836 and whatwg/html#11413
--

wpt-commits: 7ed8a2090bf6b7b601fd03aa29eb3100721df4fa
wpt-pr: 53440
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Aug 20, 2025
…, a=testonly

Automatic update from web-platform-tests
[selectors] Test :heading and :heading()

See w3c/csswg-drafts#11836 and whatwg/html#11413
--

wpt-commits: 7ed8a2090bf6b7b601fd03aa29eb3100721df4fa
wpt-pr: 53440
CSharperMantle pushed a commit to CSharperMantle/mozilla-firefox-dev that referenced this pull request Aug 26, 2025
…, a=testonly

Automatic update from web-platform-tests
[selectors] Test :heading and :heading()

See w3c/csswg-drafts#11836 and whatwg/html#11413
--

wpt-commits: 7ed8a2090bf6b7b601fd03aa29eb3100721df4fa
wpt-pr: 53440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[selectors] Adding a :heading() selector for headingoffset?
4 participants