[thelist] stupid CSS question
rudy
r937 at interlog.com
Tue Nov 27 19:52:42 CST 2001
> but can I do:
>
> .foo{color:#FFFFFF;}
> .foo.fee{font-size:11px;}
well matt, it seems like you've heard a half dozen different, partially
conflicting, possibly overlapping, sometimes browser-dependent, and
definitely inconsistent answers to your question
james had an interesting comment:
"While this [ie's inability to understand the multiple class selector]
doesn't negate the value of being able to assign multiple classes
to an element, it does diminish it."
that's putting it mildly
a lot of css will only work in the most recent browsers and you'd be wise
to seek, um, simpler solutions
to wit --
patient: doc, it hurts when i do this!
doctor: so, don't do it
so maybe instead of --
<div class="foo">
<p>this should be FFFFFF</p>
<div class="fee">
<p>this should be 11px and it might be FFFFFF</p>
</div>
</div>
you might analyze the situation and decide to declare your classes
differently so that they do not rely on decendence or adjacency or
childhood
so instead of
.foo{color:#FFFFFF;}
.foo.fee{font-size:11px;}
you might go with the tried-and-true
.foo{color:#FFFFFF;}
.foofee{ /* note class name is foofee */
color:#FFFFFF;font-size:11px;}
<div class="foo">
<p>this should be FFFFFF</p>
<div class="foofee">
<p>this should be FFFFFF and 11px</p>
</div>
</div>
anyhow, perhaps your question was only academic, rather than an immediate
situation you're trying to solve
in that case, check out the various selectors here --
http://www.w3.org/TR/REC-CSS2/selector.html
rudy
More information about the thelist
mailing list