W3C home > Mailing lists > Public > www-talk@w3.org > May to June 2003

CSS - definitions, substitutions

From: Petr Stanicek <pixy@pixy.cz>
Date: Tue, 10 Jun 2003 16:45:19 +0200
To: "www-talk" <www-talk@w3.org>
Message-Id: <28559FE0-9B52-11D7-B597-000A9568F2BE@pixy.cz>

Hi everyone,

are there some activities to implement a kind of substitutions, or (at 
least) user-constants definitions into future versions of CSS?

I couldn't find anything like this in CSS drafts - even if I think this 
could be very useful way to simplify style sheets and improve their 
authoring and administration.

There are many ways to do that, I try several examples to show what I 
mean:

***** Example 1 - simple constant definitions:

@define {
	mycolor1: #fc9;
	mycolor2: #039;
	}
...
#header {
	background: mycolor1;
	...
	}
a:link { color:mycolor2 }

etc.

***** Example 2 - more sophisticated definitions/substitutions:

@define mytext1 {
	font: normal 95%/1.5 serif;
	color: #060;
	}
@define columnblock {
	width:90%;
	margin: 0.5em auto;
	padding: 3%;
	border: 1px solid black;
	background: #ffff80;
	}
...
#leftcolumn .box {
	use-definition: columnblock;
	use-definition: mytext1;
	}
#rightcolumn .box {
	use-definition: columnblock;
	background: yellow; /* redefinition */
	}

etc.

***** Example 3 - and now, something completely different: internal 
inheritance

#box2 {
	inherit-rules: #box1;
	}

or, more stronger:

#box2 {
	parent: #box1;
	/* box2 behaves as if it's child of box1 */
	}

or, something else:

#box2 {
	margin: inherit(#box1);
	color: inherit(#header);
	...
	}

etc... Many, many ways to do similar things...

Of course, it's possible to use PHP/ASP for style sheets, which makes 
this functionality - at least definitions - but it's slows down the 
server and causes several other complications... CSS implementation 
would be much better.

Could something similar be in a future version of CSS?


	________ ,_ ______________________________
	Petr STANICEK        <><        aka -pixy-
	mailto: pixy@pixy.cz    http://www.pixy.cz
	__________________________________________
Received on Tuesday, 10 June 2003 16:57:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:27 GMT