Re: [css3-writing-modes], option #4, use of CSS constants

?The more the things go, the more new use-cases
are found for CSS variables. The only thing for which
we don't find anything about it is a concensus on
the subject :-)

For my part, I see another con for variables, though.

It's that it makes necessary (or at least more important)
to have a "framework" stylesheet which defines the
way an UA should understand the other stylesheets. Until
that file is analyzed, I don't think an UA can parse any
stylesheet properly, which delays the page load.



-----Message d'origine----- 
From: Andrew Fedoniouk 
Sent: Tuesday, October 26, 2010 6:35 AM 
To: www-style@w3.org 
Subject: [css3-writing-modes], option #4, use of CSS constants 

CSS constants is a generic way of adding "virtual properties and values".

So if we would have CSS constants then anyone will able to declare 
the following:

@media writing-direction(ttb)
{
   @const margin-start: margin-top;
   @const margin-end: margin-bottom;
}
@media writing-direction(ltr)
{
   @const margin-start: margin-left;
   @const margin-end: margin-right;
}
@media writing-direction(rtl)
{
   @const margin-start: margin-right;
   @const margin-end: margin-left;
}

div 
{
   @margin-start: 20px; /* declaration of 'logical' properties */
   @margin-end: 10px;
}

constants in CSS have its own value and are useful in many 
other cases too.

Pros:

1) Given option does not require creation of any new attributes.
@margin-start and @margin-end are just "conditional aliases" of
margin-left and margin-right. 

2) We don't need to worry in the spec about particular names -
authors may choose anything they like.

3) This will support any other forms of "property virtualization",
even those we don't know yet.

3) @const's are very useful by themselves.

Contras:

1) @const'ants need to be added to CSS.


Hope all of this makes sense.

-- 
Andrew Fedoniouk

http://terrainformatica.com

Received on Tuesday, 26 October 2010 06:38:54 UTC