W3C home > Mailing lists > Public > www-style@w3.org > April 1998

Re: Maybe I'm wrong about the Cascading order

From: Bert Bos <bbos@charlotte.inria.fr>
Date: Sun, 12 Apr 1998 18:06:55 +0200
Message-Id: <199804121606.SAA00857@charlotte.inria.fr>
To: roconnor@uwaterloo.ca
Cc: www-style@w3.org
Russell Steven Shawn O'Connor writes:
 > I went back and re-read the sections on the cascading order is CSS1 and
 > CSS2, and I'm a little confused.
 > 
 > If an author style sheet has the rule  ``EM { color: black }'', and
 > the user style sheet has the rule ``P EM { color: white }''.   In the case
 > where an EM element is inside a P element, is its content black or white?
 > I thought it'd be white.  But after reading the specs I'm not so sure.

It's black.

 > 
 > The confusion is because I don't know what you mean by ``then sort''.
 > 
 > We are first supposed by sort these rules by author reader.  So we get the
 > order.
 > 
 > 1. EM { color: black }
 > 2. P EM { color: white }
 > 
 > Then we sort by specificity.  If we sort the above list by specificity we get

The intention is that you only need to do the next step if the first
one doesn't yield an answer. Or stated differently: the primary sort
key is the weight/origin, the secondary key is the specificity, and
the tertiary sort key is the source order.

 > 
 > 1. P EM { color: white }
 > 2. EM { color: black }

This is wrong.

 > 
 > But if we instead sort each ``block'' obtained in the previous sort we get
 > 
 > Author style sheet
 > 1. EM { color: black }
 > User style sheet
 > 2. P EM { color: white }

This is right.

 > 
 > I hope you see where my confusion arises from.  Can someone clarify this
 > for me, and perhaps clarify this in the specs.  Thanks.

We'll check carefully for any ambiguity.


Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 4 93 65 76 92               06902 Sophia Antipolis Cedex, France
  +33 (0)4 92 38 76 92 (<--- after 5 Jan 1998)
Received on Sunday, 12 April 1998 12:10:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:54 GMT