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

Re: [csswg-drafts] [css-flexbox][css-grid] Choose a single option for resolving padding and margin percent values of grid/flex items

From: Lu Nelson via GitHub <sysbot+gh@w3.org>
Date: Fri, 29 Dec 2017 20:25:55 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-354496458-1514579154-sysbot+gh@w3.org>
Being able to reference the width or height of an element as a unit, either in the form of `50%w` or just `50w` would solve the aspect-ratio use-case elegantly and offer much more to CSS generally than the creation of a dedicated `aspect-ratio` property; but I agree with @tabatkins that this has no bearing on the question at hand.

The legacy is that percentage-based `margin` or `padding` refers to the width of the of the containing (parent) element, and personally I've always felt this fit with the 'grain of the web' (so to speak): e.g. the fact that block elements expand to the width of their container but have no intrinsic height. I feel this behaviour (asymmetric) makes sense for block and flexbox both, and should be spec'd as such.

However, Grid is an explicitly two-dimensional layout system in which there *are* intrinsic/implicit heights (of parents, children, grand-children, etc), and I think a clear use-case for having percentage-based `margin` and `padding` behave symmetrically. 

So my vote is for option 1, from @atanassov 's second comment: asymmetric for flex, symmetric for grid.

GitHub Notification of comment by lunelson
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2085#issuecomment-354496458 using your GitHub account
Received on Friday, 29 December 2017 20:25:57 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:21 UTC