cascade (whole selector or parts of selector) rules?

Giganews Newsgroups
Subject: cascade (whole selector or parts of selector) rules?
Posted by:  Richard Barnet (rbarn…
Date: Tue, 15 Jul 2003

Dear CSS gurus,

My question regarding 'the cascade' is a simple one, but one that I haven't
heard anyone talk about before:

When cascading (for instance, when applying two linked stylesheets), does
the whole selector definition supercede and replace a previous one, or does
it go through the selector definition line by line (rule by rule) and only
supercede rules and attributes that are previously defined?

In other words, if you have the following in a permanant stylesheet (as
opposed to persistant or alternate):

div.nav {
text-align : center;
border-bottom: 1px solid #ffff00;
background: #ff4500;
font: bold 12px/normal Arial, Helvetica, sans-serif;
color: #ffffff;

and then the user switches to a stylesheet (chooses an alternate stylesheet)
that contains the following (and is defined in coding order after the
previous sheet):

div.nav {
text-align : left;

do you lose all of the other rules (color, border, etc.), or will you retain
them and the only thing that will get superceded will be the 'text-align'
attribute ('center' gets superceded by 'left')?

The reason I'm asking is because in my limited experience, and in IE6 at
least (haven't yet tested in Moz, etc.), it seems that the second "div.nav"
definition completely wipes out the first one, which forces me to have to
copy and paste quite a bit of redundant information from one stylesheet to

I thought the whole point of the cascade was to look rule by rule and either
supercede or append rules into the document, not to supercede entire
definitions as a whole.  Am I wrong?

-- Richard