Re: aspect-ratio property

On Thu, Jan 5, 2012 at 4:36 AM, Matthew Wilcox <elvendil@gmail.com> 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?

This is problematic due to implicit dependencies.  If the width
depends on the height (for example, if this was in a vertical text
writing-mode), then you've got a problem - you can't calculate the
width until you know the height, but you can't calculate the height
until you know the width.

'aspect-ratio' covers this by deferring to the measure dimension and
then applying the ratio to the extent dimension (in horizontal text,
the measure dimension is width and the extent is height).  It also
lets you "set and forget", so that you can explicitly control *either*
the height or the width and it still maintains the appropriate ratio.

~TJ

Received on Thursday, 5 January 2012 18:46:00 UTC