Re: [csswg-drafts] CSS pseudo-selector for h1-h6? (#1008)

It looks like heading-level adjustment in HTML might happen again, this time via some slightly more explicit mechanisms rather than implicitly thru the outline algorithm: <https://github.com/whatwg/html/issues/5033#issuecomment-2691535596>

So, we should step this up in priority. Anne thinks we need `:heading()` pseudo-classes alongside the HTML functionality, and I think they're right.

Just reiterating the proposal:

* `:heading` to match any heading element
* `:heading(An+B)` to match headings whose level match the An+B expression

Question: this is *effectively* a convenience selector (especially the bare `:heading`), but it also upgrades the specificity from 1 element to 1 class. Do we want to do some specificity trickery with this and have it count as an element? Or just let HTML hack around that itself for its UA stylesheet (`:is(a:not(*), :where(:heading)))` works...)? Or finally extend `:where()` to allow setting specificity explicitly, as we discussed a little bit in <https://github.com/w3c/csswg-drafts/issues/1170>?

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1008#issuecomment-2695043263 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 3 March 2025 17:10:04 UTC