W3C home > Mailing lists > Public > www-style@w3.org > March 2016

Re: complex uses for variables in css

From: Felipe Nascimento de Moura <felipenmoura@gmail.com>
Date: Tue, 1 Mar 2016 11:57:27 -0300
Message-ID: <CAJVBkV=dQBVjZScgi=A2bxUcAaTO1KJ=JyWC4DSJCfFPArVuEA@mail.gmail.com>
To: Xidorn Quan <quanxunzhen@gmail.com>
Cc: www-style <www-style@w3.org>
indeed.
And I suppose there isn't a way to "parse" it into a string...is there?
This way the content could be kinda dynamic...
I imagine using the media queries to set the values of variables, and the
things magically adjusting themselves.
I am writing an article about it and want the demo to show the value of the
variable in its center (in the middle element).

Of course there would be other ways to do so, but I intend to explore the
variables in CSS :)

Thanks a lot.

On Tue, Mar 1, 2016 at 11:49 AM, Xidorn Quan <quanxunzhen@gmail.com> wrote:

> On Tue, Mar 1, 2016 at 10:45 PM, Felipe Nascimento de Moura
> <felipenmoura@gmail.com> wrote:
> > that totally makes sense! Thanks. By the way...
>
> By the way, please do not top-posting in www-style mailing list.
>
> > it is impossible to use it in `content`, like so
> >
> > ```css
> > :root{
> >   --size: 10px;
> > }
> >
> > .label::after {
> >   content: var(--size);
> >   /* ... */
> > }
> > ```
> >
> > Maybe that could be something useful too.
>
> This is just because you use the wrong type here. This rule would just
> be expanded to "content: 10px;", does it make any sense? If the
> variable is a string, it should certainly work.
>
> - Xidorn
>



-- 
*Felipe N. Moura*
Senior Web Developer and System Analyst.

Website:  http://felipenmoura.com
Twitter:    @felipenmoura <http://twitter.com/felipenmoura>
LinkedIn: http://goo.gl/qGmq

Meet some of my projects:
BrazilJS Conference <http://braziljs.com.br/>  |  BrazilJS Foundation
<http://braziljs.org>
---------------------------------
*Changing  the  world*  is the least I expect from  myself!
Received on Tuesday, 1 March 2016 14:58:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:01 UTC