Follow

I can't seem to find the precedence rules that explain the specificity of `a:not([href]):not([tabindex])`. Apparently the :not there override having a more specific class and parents?

@icedquinn The selector I shared, trying to override that, is from Bootstrap. I'm using a library which uses un-targetted hrefs to do on-click things. (should be buttons not anchors, I know...)

@worldsendless :not(whatever) has the same specifity as whatever itself, AFAIR. So, count whatever is inside normally.

So, a:not([href]):not([tabindex]) has specificity of (0, 2, 1).

@tennoseremel awesome! There can I learn more about those preference numbers for selectors? I have never seen it given numeric precision before.

@worldsendless You can check it there:

w3.org/TR/selectors-4/#specifi

or previous Selectors levels if a draft is not to your liking, but it shouldn't change much if at all.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.