- From: Rick <graham.rick@gmail.com>
- Date: Tue, 20 Jan 2015 18:33:17 -0500
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: "www-svg@w3.org" <www-svg@w3.org>
Functionally this appears to address my example, and many other examples I could conjure. Particularly interesting is the calc() function. Would it be possible to use calc() in the same manner as var() or is it restricted to a style? i.e. <g style="--width: 6;"> <rect width="var(--width)" height="6" /> <rect x="var(--width)" width="var(--width)" height="12" /> <rect x="calc(var(--width)*2)" width="var(--width)" height="7" /> </g> Lastly, would it be possible to have the result of a calc() return a displayable text string? I have no idea how that might be declared. (tref? ;]) On 1/20/15, Tab Atkins Jr. <jackalmage@gmail.com> wrote: > On Tue, Jan 20, 2015 at 2:40 PM, Rick <graham.rick@gmail.com> wrote: >> I see the group is discussing referencing CSS Values and Units instead >> of specifying <length> in SVG >> >> Other useful alternatives occur to me. I don't know if this has been >> discussed. >> >> Could it be possible to have one length (or other) value tied to >> another in the following fashion? >> >> <rect id="rect_1" width="6" height="6"/> >> <rect id="rect_2" width="url(#rect_1):width" height="12"/> >> >> There are many ways this could be encoded, the objective, to tie the >> value of one attribute to the value of another using a declarative >> method in a fashion similar to <use>, but at the attribute level. > > The closest thing is the use of CSS Variables > <http://dev.w3.org/csswg/css-variables/>, which are definitely usable > in style attributes on the element and should be usable in all > presentation attributes. That way you can define a given value once, > and use it in multiple places, like: > > <g style="--width: 6;"> > <rect width="var(--width)" height="6" /> > <rect width="var(--width)" height="12" /> > </g> > > ~TJ > -- Education is what you get when you read the fine print Experience is what you get when you don't.
Received on Tuesday, 20 January 2015 23:33:44 UTC