W3C home > Mailing lists > Public > www-style@w3.org > October 2003

Suggestion: Property for inheritance prevention

From: Jens Meiert <jens.meiert@erde3.com>
Date: Tue, 21 Oct 2003 10:28:29 +0200 (MEST)
To: "W3C CSS" <www-style@w3.org>
Message-ID: <31325.1066724909@www53.gmx.net>

In short: What about a special property to prevent inheritance in documents,
like e.g. 'inherit: (yes|no);' or 'reset: (true|false);'? -- I experienced a
special situation where I wished to prevent the overall styles to be
inherited to a (in this case) layer... but I'd better explain my suggestion by a
concrete (and simple) example:

-- General document stylesheet

   td { color: #000;
         border: 1px solid #F00;
   }

Special situation: I now integrated an external document (using an own
stylesheet) by embedding its structure in a layer, whose ID here is 'foo'; its
stylesheet is again referenced externally and I only added the ID selector to it
to get a contextual selector in combination with each element.

-- Embedded document (layer) stylesheet

   #foo td { color: #666; }

As you can imagine is the general document style for 'td' now being
inherited to the layer, so each table cell now gets a red thin border. Of course its
simple to modify the layer stylesheet by adding 'border: none;' or anything
else to it, but imagine there are 20, 30, 40 properties you would have to
change (and to compare with all of the general stylesheet).

So I thought about a simple solution for this by only using an 'inherit' or
'reset' property:

  #foo { inherit: no;
         /* reset: true; */
  }

   #foo td { color: #666; }

...thus only applying the styles explicitly set for the corresponding
element (here: a contextual selector for elements within the 'foo' layer).

Maybe there is one thing to notice when talking about this phenomenon -- the
mentioned experience (of course at least partially) results from some buggy
browser support, so the suggested property is maybe not that useful (or
necessary) in the future -- I can't exactly determine while not being that
familiar with the current CSS draft at the moment.


Best regards,
 Jens.


PS.
I don't hope not to see the wood for the trees...


-- 
Jens Meiert
Interface Architect

http://meiert.com
Received on Tuesday, 21 October 2003 04:28:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:24 GMT