Re: CSS 2: priorities in cascading order

On Mon, 22 Dec 1997, Jason White wrote an example. Let me give one too.

Given the following user style:

li { color: red ! class ! important}
li { color: green ! id}

and an author's style which provides as follows:

ol li.abc { color: blue ! important }
ol li#theItem { color: blue ! important }
ol li#anotherItem { color: blue }

then if there is an ordered list in the document such as:

<ol> <li class="abc"> This an item in an ordered list.
<LI ID="theItem">This item has an id code.
</ol>

The first item will be red, since the user has specified a rule which 
covers classes, and is ! important
The second item will be blue, since the user's rule is less specific.
The third item will be green, since there is a user rule covering "not 
important" id-specific items.

What i am not yet sure about is whether a user rule for id should be 
specificity 100, or x00 where x is an arbitrarily large number, or 1xx
(These are from the CSS2 Working draft explanation of specificity, 
http://www.w3.org/TR/WD-CSS2/cascade.html#h-7.1.2)

Charles McCathieNevile

Received on Sunday, 21 December 1997 21:23:08 UTC