Specificity with id selectors

Consider the following selectors:




It is my understanding that by the rules of specificity, the former rule can
be said to have greater specificity. Is that correct, even though there
cannot legally exist more than one element with the same id attribute?

In my tests, browsers ignore a rule with the #myID selector if a rule for
div#myID also exists anywhere in the document.


P.S. Thanks to everyone who responded to my off-topic question regarding
important declarations. For those of you that were worried, I'm not trying
to usurp user style sheets! I'm working on a book and just wanted to get my
facts straight.

Received on Friday, 15 June 2001 14:07:39 UTC