Re: [css-values-4] String concatenation

On Jul 19, 2014, at 22:14, Sylvain Galineau <galineau@adobe.com> wrote:

> The decision and the design should be based on use-cases; in the quoted IRC thread Lea mentions using attr() in url() being useful for things like data URIs. Lea, can you elaborate on what you had in mind?

I often use lightly urlencoded SVG data URIs in CSS, especially for my book (since there filesize doesn't matter) and it would be very useful to be able to apply the same parameterized data URI to various elements, only changing an attribute on the element, or a CSS variable. For example (not super common, but recent, so it comes to mind first), an SVG file that creates simple pie charts, using attr(data-value) in stroke-dasharray for the percentage. Then, one could make pie charts with things like <div data-value=".5">50%</div>.

Marat also mentioned a very common use case, even though his specific example is not great. But synthesizing image URLs from attributes, variables, even counters is something I expect to be incredibly common once this is allowed & widely implemented.

~Lea

Received on Sunday, 20 July 2014 20:08:13 UTC