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

Re: aspect-ratio property

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 5 Jan 2012 10:45:09 -0800
Message-ID: <CAAWBYDDJa40LJOY7KYKaSK2cfceL=oGaBWWe3kZ=C5rOv=SxDw@mail.gmail.com>
To: mail@matthewwilcox.com
Cc: www-style@w3.org
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.

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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:54 UTC