Previous Message
Next Message

Re: [css-d] Inheritance within the style sheet

Sent by Dougal Campbell on 31 January 2002 12:12


On Thu, 31 Jan 2002, John Reeve wrote:

> I'm trying to find a way to build inherited relationships inside of the
> style sheet. For example, i'd like to declare a style called "td.lineItem".
> And then i'd like to define a style called "td.lineItem_blue" that inherits
> all of the values declared in "td.lineItem". [....]
> 
> [....] The solution I am using now is to declare "td.lineItem_blue" twice.
> Once to initialize its values with those in "td.lineItem" and again to add
> new values. [....]
> 
> Is the latter snippet of code valid and forward-compliant?

Yes.

> Is there an easier way to do this?

Perhaps. But I think there a couple of browers that might have issues 
with it. How about:

  td.lineItem { /* main lineItem stuff */ }

  td.blue { /* stuff specific to the blue version */ }

  [....]

  <td class="lineItem blue">This is lineItem <em>and</em> blue</td>

You can specify multiple clases, and they will all be applied. But some 
browsers (not sure which ones offhand, but definitely NN4) will only 
apply the first style, and ignore the others. I think this is a CSS2 
deal, so browers that only have CSS1 support won't do it.

-- 
Ernest MacDougal Campbell III, MCP+I, MCSE [EMAIL-REMOVED]>
http://dougal.gunters.org/             http://spam.gunters.org/
  Web Design & Development:  http://www.mentalcollective.com/
       This message is guaranteed to be 100% eror frea!
Previous Message
Next Message

Message thread: