W3C home > Mailing lists > Public > www-style@w3.org > April 2014

Re: CSS variable syntax

From: François REMY <francois.remy.dev@outlook.com>
Date: Thu, 3 Apr 2014 18:42:31 +0200
Message-ID: <DUB130-DS790EE1BCF0B6523BA9C84A56C0@phx.gbl>
To: "Mark Volkmann" <r.mark.volkmann@gmail.com>, "Chris Eppstein" <chris@eppsteins.net>
Cc: "Simon Sapin" <simon.sapin@exyr.org>, "Jens O. Meiert" <jens@meiert.com>, "W3C WWW Style" <www-style@w3.org>
> I'm not familiar with what @ is being used for.
> Why couldn't variables start with @?

They are being used for at-rules, like @media, @page or @supports. The CSS 
WG doesn't want to overload the @ symbol with two things which are clearly 
unrelated. Also, there have been proposals where people wanted to embed 
@rules inside selector rules in the past, so we should leave that door open.

> Why would it be difficult to implement this so
> that --foo in a property value means get the
> value of the foo property, making var(--foo)
> unnecessary?

This discussion already happened, in fact; please have a look for example at 
[1]. That being said, I agree with you and I think others do, too. There is 
(however) no major reason why we couldn't try to use "var" alone and then 
introduce a shorter syntax later on if it happens to be needed or heavily 
requested by users. You know, "var()" allows to do cool things like provide 
a default value, something you can't do with the keyword alone. (Well, I 
proposed to add an operator to "calc" to solve this but it didn't get much 
traction [2]).

Best regards,
François

________________________
[1] http://lists.w3.org/Archives/Public/www-style/2014Mar/0588.html
[2] as in "calc(--col-span * --col-width || --col-width || 0px)" // this 
makes var(..., ...) unnecessary 
Received on Thursday, 3 April 2014 16:42:40 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:21 UTC