Ingo Chao wrote:

> CSS 2.1:6.4.1 -4  says: "if two declarations have the same weight, 
> origin and specificity, the latter specified wins."
> 
> This sounds clear, but ... what exactly is meant by "weight"?

Weight itself is a conceptual thing in the cascade, and a weight is only
larger, smaller or equal to some other weight - acting like a switch.
We can give weight value for use down the cascade - making it easier to
comprehend, and the easiest way I've found for doing this is to extend
the specificity "counter" at both ends.

> CSS 2.1:6.4 says: "The CSS cascade assigns a weight to each style 
> rule. When several rules apply, the one with the greatest weight 
> takes precedence. By default, rules in author style sheets have more 
> weight than rules in user style sheets. Precedence is reversed, 
> however, for !important rules."
> 
> Is "weight" a result of "importance" and "origin"?

The unfriendly spec-language aside: in reality it will be - somewhere
down the line.

The way I read, and use, it is that weight is determined for each step
down the cascading order, and then the weight of the next step is
determined and added - if needed.
Since we start by determining the highest weight, and then add much
smaller weight on subsequent steps, we may in reality have determined a
safe "final weight" early on and can skip subsequent steps.
What we end up with is the "final weight" of a property/value declared
for an element.


So, the sum of 'match', 'origin', 'specificity' and 'order' ends up as
"final weight" - the way I read/use it. I do of course want to reach
elements with my styles no matter what, so I add weight until I do -
taking into account that the intervention from a user through the
cascade may kill my attempts.

regards
        Georg
-- 
http://www.gunlaug.no
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to