[thelist] stupid CSS question

Ben Henick persist1 at io.com
Tue Nov 27 16:47:59 CST 2001

On Tue, 27 Nov 2001, Matt wrote:

> ok, so I know I can do inheritance, such as:
> P{color:#FFFFFF;}
> P.foo{font-size:11px;}
> but can I do:
> .foo{color:#FFFFFF;}
> .foo.fee{font-size:11px;}

Inheritance is actually

body {color: red;}

meaning that if the rendering engine complies with the standard, all of
the copy on the page will be red (e.g. BODY COLOR="#FF0000") regardless of
its depth in the DOM for that page (with links being an obvious exception
to that rule).

You can do

.foo {}


P.foo {}

and get results.  But not

.bar.foo {}

on account of the fact that you can't assign two CLASSes to the same

If you assign an ID and a CLASS to the same element, conflicts will be
resolved in favor of the attributes assigned to the ID rule IIRC.
(Someone *please* correct me if I'm wrong).

Furthermore, classes and ID's have to be assigned as separate rules.

Ben Henick
Web Author At-Large              Managing Editor
http://www.io.com/persist1/      http://www.digital-web.com/
persist1 at io.com                  bmh at digital-web.com
"Are you pondering what I'm pondering, Pinky?"
"I think so, Brain, but... (snort) no, no, it's too stupid."
"We will disguise ourselves as a cow."
"Oh!" (giggles) "That was it exactly!"

More information about the thelist mailing list