Re: CSS Variables

On Tue, Feb 8, 2011 at 10:18 AM, Linss, Peter <peter.linss@hp.com> wrote:
> What about:
> @var $a px;             p { width: 100$a; }
> or (I don't see how to do it with the '$' syntax):
> @var b 200;             p { width: var(b)px; }

Those both require character-level variables to work as written, which are evil.

They can be accomplished in a hacky way, if you really need it:

@var $a 1px;
p { width: calc( 100 * $a ); }

@var $b 200;
p { width: calc( $b * 1px ); }

Well-defined unit algebra is much better than hacky character macros.  ^_^

~TJ

Received on Tuesday, 8 February 2011 18:32:16 UTC