W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2017

Re: [csswg-drafts] [flex] Sizing images with intrisic aspect-ratio: ¿harmonize with grids?

From: François REMY via GitHub <sysbot+gh@w3.org>
Date: Thu, 23 Mar 2017 03:12:11 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-288605317-1490238729-sysbot+gh@w3.org>
Harmonization could happen both ways. Here is a plan that would harmonize grids with flex by mapping grid to flex:

- We keep flexbox unchanged (except maybe -- if the group thinks this is worth it -- the adjusted auto flex basis for elements with intrinsic aspect ratio)
- We change grid again to behave exactly like a flex with flex-direction:column (the image having flex: 0 0 auto, or flex: 0 1 auto if we adopt the previously-mentioned change to flex). That means "normal" means "stretch" in the width axis, and "start" in the height axis (if the element has an intrinsic aspect ratio which prevents natural stretching). 
- If you want things to work differently you either want "stretch" in both directions (which you can specify), or a manual "width: contain" which will take the available height and the aspect ratio into consideration when computing the width, and solve the issue for you. 

This means images would by default behave like any other element in a grid, their width is determined first, then their height is deduced given their assigned width. With the caveat images are likely to overflow though since the grid tracks would probably have been sized without considering this. The options mentioned before allow to solve that problem though. To an author this is highly predictable and quickly understandable.

Thoughts? @fantasai @tabatkins @mrego 

-- 
GitHub Notification of comment by FremyCompany
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1112#issuecomment-288605317 using your GitHub account
Received on Thursday, 23 March 2017 03:12:21 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:30:30 UTC