W3C home > Mailing lists > Public > www-style@w3.org > May 2010

Re: suggestion: fixed-aspect-ratio CSS rule for block elements

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 5 May 2010 23:05:56 -0700
Message-ID: <o2hdd0fbad1005052305v3a842c27jd92da5cf6798711c@mail.gmail.com>
To: Brad Kemper <brad.kemper@gmail.com>
Cc: julien.cayzac@gmail.com, www-style@w3.org
On Wed, May 5, 2010 at 9:35 PM, Brad Kemper <brad.kemper@gmail.com> wrote:
> On May 5, 2010, at 5:17 PM, Julien Cayzac wrote:
>>> 3) We add aspect-ratio, but have it only interact with 'auto' values
>>> for width/height.  So, in the previous example, the aspect-ratio would
>>> have no effect, since both width and height are already specified.  If
>>> you set height:auto instead, though, then aspect-ratio will be
>>> consulted to resolve it.  Or you could set height and leave width as
>>> auto, so aspect-ratio would also have an effect.  Finally, if both
>>> were auto (the default), then whichever is resolved first (typically
>>> width) would be resolved normally, then aspect-ratio would be used to
>>> resolve the other dimension (typically height).
>>> I like #3 the best.
>> Same here. The way dimensions get resolved is more understandable this way
> I think that is the best choice, to avoid confusion over which height/width to use. Also, I would go further and say that it only interacts with 'auto' values when there is no conflicting  min/max-width/height in that dimension (min/max takes precedence).

By that, do you mean that in this example:

#foo {
  width: 400px;
  height: auto;
  min-height: 350px;
  aspect-ratio: calc(4/3);

...the box would be 400px by 350px?  I agree.  And if the min-height
was 250px, then it wouldn't have any effect - the height would
successfully resolve to 300px.

max/min constraints should definitely still apply.

Received on Thursday, 6 May 2010 06:06:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:45 UTC