-
Notifications
You must be signed in to change notification settings - Fork 757
Open
Labels
css-flexbox-2css-grid-3Masonry LayoutMasonry Layouttag-trackerGroup bringing to attention of the TAG, or tracked by the TAG but not needing response.Group bringing to attention of the TAG, or tracked by the TAG but not needing response.topic: masonry
Description
The TAG response to the masonry syntax issue asked us to look into unifying controls for our layout modes, calling out grid-auto-flow and flex-flow (flex-direction + flex-wrap) in particular. Apple looked into this, and we have the following syntax proposal:
Introduce item-flow aliased to both flex-flow and grid-auto-flow and defined as a shorthand for the following properties:
-
item-direction(also aliased asflex-direction)row | column | row-reverse | column-reverse
-
item-wrap(also aliased asflex-wrap)auto | wrap | wrap-reverse | nowrapautocomputes to eitherwrap(for Grid) ornowrap(for Flexbox)nowrapin Grid would mean autoplacement adds implicit tracks instead of wrapping to the next row
-
item-packnormal | dense- Defining
densepacking for Flexbox would mean that instead of breaking lines as soon as an item can’t fit, we try to cram in one more, triggeringflex-shrinkbehavior instead offlex-growon that line. See [css-flexbox-2] Add flex-wrap: dense #3071. - This syntax allows the potential to expand packing controls, e.g.
item-pack: normal | dense || [ collapse | balance ]could allow:collapsetriggering a masonry-style layout for Grid (see [css-grid-3][masonry] Masonry Syntax Debate #11243).balanceopting into balanced line-wrapping for Flexbox ([css-flexbox-2] Add flex-wrap: balance; #3070).
-
item-slack<length-percentage>- This is the
masonry-slackproperty. See [css-grid] Decide on a name foritem-slack#10884. - For Flexbox, slack could say at what point you switch from loose packing to cramming:
- In normal mode,
10pxslack would mean “if there’s only 10px overflow on this line when adding the next item, cram it in anyway, as squeezing in an extra 10px is no big deal”. - In dense mode,
10pxslack would mean “if there’s only 10px empty space left on this line, don’t try to cram in the next item, that’s too much cramming”.
- In normal mode,
Caveats: This would make flex-flow and grid-auto-flow cascade as a single property, which is a change in behavior and therefore could have some Web-compat impact.
Variations: This is our initial sketch, but there are some variations we’ve considered:
- We’re unsure if
item-slackshould be a longhand ofitem-flowor not: it's often nice to put it in theitem-flowshorthand, but it might also make sense for it to cascade independently. - We’re open to ideas about the
item-prefix. Ideas we’ve come up with so far includeitem-,box-,items-, andplacement-. (We’re drawing the “item” terminology from the specs and from thealign-itemsproperty.)
Thoughts?
JoshTumath, ByteEater-pl, b-strauss, zhangenming and yanndinendalbleper, nileshprajapati and jensimmonsLoirooriol and SebastianZ
Metadata
Metadata
Assignees
Labels
css-flexbox-2css-grid-3Masonry LayoutMasonry Layouttag-trackerGroup bringing to attention of the TAG, or tracked by the TAG but not needing response.Group bringing to attention of the TAG, or tracked by the TAG but not needing response.topic: masonry
Type
Projects
Status
Friday morning