W3C home > Mailing lists > Public > www-style@w3.org > July 2004

Re: pseudoclass based on document content

From: Tantek Çelik <tantek@cs.stanford.edu>
Date: Sat, 17 Jul 2004 14:22:30 -0700
To: <lachlan.hunt@lachy.id.au>, Justin Watt <jwatt@email.unc.edu>, <www-style@w3.org>
Message-ID: <BD1EE661.4A4DD%tantek@cs.stanford.edu>

On 7/17/04 9:52 AM, "Lachlan Hunt" <lachlan.hunt@iinet.net.au> wrote:

> 
> Justin Watt wrote:
>> However the following worked fine in both browsers, so I'm not sure what
>> your "except for IE" comment was refering to.
> 
>  It was referring to the fact that Internet Exploder does not support
> multiple class names.  If you re-read what I wrote, this should make
> more sense:
> 
>>> ...there's no reason (except for IE) ...  that you can't just use a
>>> space separated list of classes...

This is not quite correct.

IE (Win and Mac) *does* support multiple class names per HTML4 and CSS1, and
if you can remember just that, and understand what HTML4 and CSS1 each
define (and are limited to) in terms of using the 'class' attribute, you can
figure out what's going on.

Thus you can have markup

 <span class="foo">element 1</span>
 <span class="foo bar">element 2</span>

and have rules

 .foo { color:blue }
 .bar { border:solid }

and have the first element be blue and have the second element be blue with
a solid border.

In CSS1, you may *not* chain class selectors like this:

 .foo.bar { background:lime }

That's a CSS2(.1) / Selectors feature, and *not* supported in IE (Win and
Mac).

Worse, due to an unfortunate bug in IE (Win and Mac), such multi-class
selectors are not properly ignored, and thus rules like these are improperly
applied (whereas they should be ignored):

.ignore.foo { color:red }
.ignore.bar { background:yellow }

Which means you have to be extra careful when using multi-class selectors,
in order to avoid having IE misapply them.

Tantek

P.S. Tasman v0.9 (e.g. MSN/MacOSX) and v1 (e.g. Office2004/MacOSX)  *do not*
have any of these problems, and support the vast majority of Selectors.
Received on Saturday, 17 July 2004 17:22:38 GMT

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