W3C home > Mailing lists > Public > www-style@w3.org > January 2012

Re: aspect-ratio property

From: Lea Verou <leaverou@gmail.com>
Date: Thu, 05 Jan 2012 16:18:26 +0000
Message-ID: <4F05CD52.9030703@gmail.com>
To: mail@matthewwilcox.com
CC: Matthew Wilcox <elvendil@gmail.com>, www-style@w3.org
On 5/1/12 12:36, Matthew Wilcox wrote:
> I'm fresh to the discussion, but I'd suggest that a better solution
> than a new property would be to work with the existing ones.
>
> div { width : 100%; height : width/2; }
>
> This seems much more flexible and easier to understand?
>
calc() was introduced for a reason. Your example should at least be 
height: calc(width/2); which is much easier to parse and hardly hinders 
readability.
As for introducing a `width` keyword, I'd imagine that doesn’t scale 
very well: Which properties would become keywords? All? Just `width` and 
`height`? Why, are they "special"? I think if we’re going to do anything 
like that, we need a special notation for it. I’d propose current(), 
like a generalization of currentColor, accepting all properties. So, 
your example could be height: calc(current(width)/2);
Yes, there could be cycles like width: calc(2*current(width); but they 
can be detected and removed quite trivially.

However, I’ve discussed this with implementors a while back (it’s one of 
the highest items in my CSS wishlist) and it seems pretty much 
impossible, at least if layout properties are included, as per your 
suggestion. Even currentColor on its own is hard (I remember Simon 
Fraser writing "I hate currentColor :(" in one of my Webkit bug reports 
about it.

-- 
Lea Verou (http://lea.verou.me | @LeaVerou)
Received on Thursday, 5 January 2012 16:18:58 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:48 GMT