"brucie" <br******@bruciesusenetshit.info> wrote in message
news:br*************@ID-117621.news.uni-berlin.de...
in post <news:a2**************************@posting.google. com>
David Beardsley said:
Is there no way to refer to an existing rule to set a value for a new
rule short of generating a style sheet server side?
For example:
div.a {color: blue;}
div.b {color: div.a.color}
.blah{..common properties..}
.color1{color:red;}
.color2{color:blue;}
class="blah color1"
class="blah color2"
To expand on Brucie's post...
Your HTML elements inherit the styles that you specify. If your HTML is
created in a nice hierarchy, then your styles should inherit automatically.
Suppose you have the following (I've changed class names to be something
meaningful):
<div class="cardetails">
<div class="make">Toyota</div>
<div class="model">Camry</div>
</div>
In this case, if you had styles like this:
..cardetails { color: blue; }
Then you don't need to specify the color for class "make" because it will be
inherited.
Now, if your HTML is less hierarchical and looks like this (nothing that
says these are children of a common class)
<div class="make">Toyota</div>
<div class="model">Camry</div>
rather than applying a color to make and a color to model, create a class
that encapsulates both objects:
..cardetails { color: blue; } /* common properties */
and add that class to your HTML elements:
<div class="cardetails make"> Toyota</div>
<div class="cardetails model">Camry</div>
This approach works, but is not as friendly to work with (IMO).
Regards,
Peter Foti