Re: ECMAScript in CSS aka "Expressions"

Maybe a good compromise is a sum (or difference) of different units.

   font-size:0.65em+2px

The units can be treated internally by an editor
like vectors with one element corresponding to each unit.
When serializing, zero-valued vectors could be omitted, but
a single zero would be generated if all are zero.

This keeps tools simple and consistent, and it may keep them
from generating overly obscure expressions with arbitrary
convoluted possibilities. (finding examples of prior art in
convoluted document encoding left as an exercise to the reader)

Bert Bos wrote:
> On Monday 07 March 2005 21:32, David R wrote:
> 
>>This may have already been discussed, but since I haven't been a
>>member of the list for long, forgive me if I'm raising a long-dead
>>subject...
>>
>>But what is the current state of "ECMAScript in CSS" aka
>>"Expressions" (as a recommendation put forward to the W3C by
>>Microsoft)
> 
> 
> Not quite sure if this is what you mean, but the working group recently 
> decided to investigate the implications of allowing simple, linear 
> expressions as values. For example:
> 
>     width: expr(50% + 5px);
>     font-size: expr(2em / 3 + 2px);
>     padding-right: expr(1px + 1ex - 5%);
> 
> They make life harder for GUI-based editors, but sometimes it is handy 
> to be able to add different kinds of units together.
> 
> Some common cases can be done without expressions, by means of a few new 
> units:
> 
>     gd = the grid unit from CSS3 Text
>     rem = the font size of the root element
>     vw = the viewport width (or 1/100th of it)
>     vh = the viewport height (or 1/100th of it)
>     vm = min(vw, vh)
> 
> There is not even a draft yet, though.
> 
> 
> 
> Bert

Received on Tuesday, 15 March 2005 21:03:37 UTC