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

RE: [Css Variables] Variable Declaration Blocks

From: Mike Wilson <mikewse@hotmail.com>
Date: Mon, 6 Oct 2008 17:07:32 +0200
Message-ID: <BAY116-DAV966285893BA4560BE32B7A4390@phx.gbl>
To: "'Chris Miller'" <chris@blinkbox.com>
Cc: <www-style@w3.org>
Message-ID: <020001c927c5$41a7b400$0a01a8c0@mikedeskxp>

I agree with you Chris and I'll add a few bits to (2):

> Andrew Fedoniouk wrote:
> > 2) Why they are variables and not constants?

I'll reverse the question and ask why shouldn't everything in 
CSS be constants then? The same reasoning could be applied to 
the current CSS rule scheme and we could have "first rule wins"
for everything, and no CSSOM modification after loading. We
could even lock down script modification of HtmlElement.class
and HtmlElement.style so all style and layout could be settled
once and for all during load-time.
Personally I wouldn't want it to function this way, maybe some
would, and I'd like to see variables use the same scheme as the
rest already do.

Talking about "run-time" modification of styles we already have
f ex the following support in current implementations that will
all lead to dynamic update of style/layout on elements:

- change class on an HTML element through DOM
- change properties on rule through CSSOM
- add/remove rules through CSSOM
- load a new style sheet through CSSOM
- element style inheritance of changes by above operations

Not offering run-time updates for variables would feel poor 
considering the above list, especially since composite/complex 
variables have the potential to become a main design element in 
future CSS.

Best regards
Mike Wilson

Chris Miller wrote:
> I've only been on this mailing list for a couple of months 
> now so please forgive me if I've overlooked some important 
> discussions surrounding this subject. Feel free to point me 
> in the direction of any relevant information that I may have missed.
> 
> In answer to your questions from my perspective:
> 
> 1)
> 
> >> Basic organisation & structure.
> "The ability to define consistent attributes in a single location"
> 
> This allows developers to organise basic information (e.g. 
> colours & lengths) in a single location in order to improve 
> structure & ease maintenance. 
> The only ways to achieve this currently are by using basic 
> search and replace, a CSS pre-processor or multiple classes 
> in the HTML.
> 
> 
> >> True Inheritance / partial styles.
> "The ability to apply a (partial) set of CSS attributes to 
> multiple style definitions"
> 
> A natural extension of the first point is to be able to set 
> multiple attributes at the same time (although this would 
> make any implementation far more complex). A couple of 
> examples would be border/background/padding and 
> font/color/text-decoration combos. Another example would be 
> to apply the easyclearing technique to specific containers 
> from within the CSS.
> Currently the only ways to achieve this are a CSS 
> pre-processor or multiple classes in the HTML.
> 
> 2) 
> 
> In all of the above examples, it would make sense to allow 
> this to be modified on the client using the CSSOM. By doing 
> this, you would give the proposal a clear advantage over the 
> other approaches.
> 
> Also, using multiple classes in the HTML would seem to go 
> against the idea of separating content from style (IMHO).
> 
> 3) Gets my vote...
> 
> Kindest Regards
> Chris
> 
> Refs:
> http://disruptive-innovations.com/zoo/cssvariables/
> http://www.positioniseverything.net/easyclearing.html
> 
> 
> 
> 
>  
> BlinkBox Entertainment Ltd - don't just watch
> Chris Miller | Development Engineer | +44 20 7092 8700
>  
> -----Original Message-----
> From: www-style-request@w3.org 
> [mailto:www-style-request@w3.org] On Behalf Of Andrew Fedoniouk
> Sent: 01 October 2008 17:46
> To: www-style
> Subject: Re: [Css Variables] Variable Declaration Blocks
> 
> 
> Why would people need "CSS variables" at all?
> 
> We've got a lot of discussion around them but I am failing to
> see the forest behind those trees.
> 
> Could anyone clearly explain why "CSS variables" there at all:
> 1) What problems they are trying to solve, etc.?
> 2) Why they are variables and not constants?
> 3) Are there any requests from community for exactly variables?
> 
> Thanks in advance.
> 
> -- 
> Andrew Fedoniouk.
> 
> http://terrainformatica.com
> 
> 
> 
> 
> 
> 
> 
> 
Received on Monday, 6 October 2008 15:08:53 GMT

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