W3C home > Mailing lists > Public > www-validator-css@w3.org > May 2002

rule inheritance (RE: CSS Validator doesn't like "_" characters in the ID of a style definition)

From: Philippe Le Hegaret <plh@w3.org>
Date: 31 May 2002 16:14:37 -0400
To: "Lyders, Richard" <Richard.Lyders@Airliquide.com>
Cc: Bjoern Hoehrmann <derhoermi@gmx.net>, www-validator-css@w3.org
Message-Id: <1022876078.23970.164.camel@jfouffa>

On Fri, 2002-05-31 at 16:03, Lyders, Richard wrote:
> Philippe and Bjoern,
> Do you know if there is a way for one CSS style definition to inherit
> properties from another CSS style defintion?
> 
> For instance, rather than having to duplicate the properties for two similar
> styles as shown below:
> 
> <style>
>   .BigBoldRedTitle {
>     COLOR: RED; 
>     FONT-FAMILY: "Verdana"; 
>     FONT-SIZE: 40pt; 
>     FONT-WEIGHT: bold;
>   }
>   .BigBoldRedTitleOnYellow {
>     COLOR: RED; 
>     FONT-FAMILY: "Verdana"; 
>     FONT-SIZE: 40pt; 
>     FONT-WEIGHT: bold;
>     BACKGROUND-COLOR: yellow;
>   }  
> </style>
> 
> I would like to be able to define BigBoldRedTitleOnYellow to inherit from
> BigBoldRedTitle such as:
> <style>
>   .BigBoldRedTitle {
>     COLOR: RED; 
>     FONT-FAMILY: "Verdana"; 
>     FONT-SIZE: 40pt; 
>     FONT-WEIGHT: bold;
>   }
>   .BigBoldRedTitleOnYellow {
>     CLASS: BigBoldRedTitle;
>     BACKGROUND-COLOR: yellow;
>   }  
> </style>
> 
> Is there any way to do this?

The short answer is "no".

By using more than one class on your element, you can factorize some of
the properties but you cannot have inheritance between rules.

Philippe
Received on Friday, 31 May 2002 16:15:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 June 2012 00:14:11 GMT