OK,
very good answers all, and I tend to agree
I suppose it might be best considered like this
h1, h2 {}is *really*
h1{}
h2{}BTW, just a little aside,
this is just a tiny example of why writing browsers, and development tools is really hard, because these kinds of issue come up all the time with specifications.
Joe Spolsky's recent Salon interview (reg required at salon.com) touches on this,
thanks for all the answers, I buy them :-)
J
On 15/12/2004, at 10:03 AM, russ - maxdesign wrote:
They have the same weight. They are just groupings of individual selectors.
http://www.w3.org/TR/CSS21/selector.html#grouping
Theoretically, a browser must sort each element separately, so it will gather any rule that includes an h1 and then sort out the weightings.
As the browser has to look at each mention of an individual element, it
would treat "h1, h2" as two separate rule sets to be sorted separately when
their relevant elements are being sorted.
My 2 cents Russ
Perhaps someone has seen, or has a definitive answer to this question
which has the higher specificity
h1 {}
or
h1, h2 {}
(don't worry about the order in the style sheet, just in an absolute sense)
Relevant part of the CSS specification is here
http://www.w3.org/TR/CSS21/cascade.html#specificity
FWIW, I think it is ambiguous. But strictly thinking,
"count the number of element names and pseudo-elements in the selector"
I interpret to mean that the group is of specificity 2, and so higher than the type selector, of specificity 1 Or do they both have a specificity of 1?
Thanks, interested in people's thoughts,--------------------------------------------
****************************************************** The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ******************************************************
John Allsopp
:: westciv :: http://www.westciv.com/ software, courses, resources for a standards based web :: style master blog :: http://westciv.typepad.com/dog_or_higher/
****************************************************** The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ******************************************************
