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

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 UTC