W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2020

Re: [csswg-drafts] [css-sizing-4] aspect-ratio min-content size with % width (#5549)

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Mon, 05 Oct 2020 19:03:07 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-703828149-1601924585-sysbot+gh@w3.org>
Looking at the "bound width and height" example, the markup is real confusing because it's using abspos on the element to make it fill the parent (and the interaction between abspos with non-auto insets and aspect-ratio, it turns out, isn't well-defined; the Position and Sizing specs both try to define the automatic sizes), but if I unset all of those properties...

I can end up with an empty block element, with a set aspect-ratio (say, `1/1`) and `min-width/min-height:100%`, laid out into a container with a set width and height. Since both `width` and `height` are `auto`, `width` is the ratio-determining dimension, and `height` is the ratio-dependent dimension. Because it's a block element, it expands to the width of its container, then tries to apply its 1/1 ratio to make the height the same size, but that gets limited by the `max-height:100%`, thus breaking the aspect-ratio.

The bug here is that sizing constraints are meant to transfer across the ratio as well; search for "Additionally, sizing constraints in either axis" in <https://drafts.csswg.org/css-sizing-4/#aspect-ratio>. This means the `max-height:100%`, resolving to a smaller length, should transfer across the 1/1 ratio to become a max-width constraint as well, which would prevent the element from growing to the full width of its container; instead, it'll stay a perfect square.

GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5549#issuecomment-703828149 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 5 October 2020 19:03:09 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:20 UTC