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

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