* lon.kraemer wrote:
>> * lon.kraemer wrote:
>> >Can anyone point me to documentation that explains the intricacies of
>> >specificity concerning CSS selectors. Eric uses something like
>> >1,0,0,0 or 2,1,2 etc. How does it work?
>> This is explained in http://www.w3.org/TR/CSS21/cascade.html#specificity
>Yes, I've read that. I guess I should have expressed that I don't quite
>I'm not wrapping my head around: "Concatenating the four numbers a-b-c-d
>(in a number system with a large base) gives the specificity."
In a X number system, each digit of a number has X different states,
e.g. the binary system has 2, the decimal system has 10, the hexadecimal
system 16 and so on. 2/10/16 is the base of that respective number
system. Consider you have specifity 1,0,3,0 you can concatenate these
numbers to the dezimal value 1030. That gives a specifity of 1030. Now
consider you have specifity 0,16,2,9, you cannot concatenate these
numbers to dezimal 1629, because it would then overweight the former
selectory (1030). Instead you could use the hexadecimal system (base
16), you get 0x0F29 (that's 3881 decimal). Compared to 0x1030 (4144
dezimal) the latter will win due to higher specifity. The base must at
least be as large as the highest value for a/b/c/d in order to work...
Maybe you got the trick, if not, don't care.
Basically the specification is trying to tell you: for a given quadruple
of numbers a-b-c-d:
a higher value of a is more specific,
but if they're equal then a higher value of b is more specific,
but if they're also equal then a higher value of c is more specific,
but if they're also equal then a higher value of d is more specific.
It's not important how this is implemented and the number system
concatenation is just one possible implementation, IMO.