====== CSS Flexible Box Layout ======
===== Specification =====
Latest Working Draft: [[http://www.w3.org/TR/css3-flexbox/]]
Latest Editor Draft: [[http://dev.w3.org/csswg/css3-flexbox/]]
July 23, 2009 Working Draft: [[http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/]]
===== Use Cases =====
**[[spec:css3-flexbox:Use Cases]]**
===== Accessibility Order Implications =====
Link: [[spec:css3-flexbox:Accessibility|]]
===== Implementation Report =====
//TODO: list browser versions and draft versions for partial or complete implementations//
===== Old/New Syntax Property Mapping =====
[[Flexbox 2009-2011 spec property mapping]]
===== Open Issues =====
==== Flex Box Construction ====
- [RESOLVED] Is pre whitespace ignored or preserved between elements? http://www.w3.org/mid/4F6ACDF3.1030706@mozilla.com
- [OPEN] Magic of replaced 'display: inline' elements: http://www.w3.org/mid/4FA76E7E.60604@inkedblade.net
- [CLOSED] What are expected display-inside/display-outside values for flex items, and does currently-defined behavior result in a sensible model when they are defined to exist?
- [RESOLVED] Effect of 'visibility: collapse' on flex items. http://www.w3.org/mid/D51C9E849DDD0D4EA38C2E5398569284121366F7@TK5EX14MBXC213.redmond.corp.microsoft.com
* Proposal A: Stays in box tree, but has special layout: Do layout once normally, then collapse it to a strut of its line's cross size and lay out again. (This keeps the cross-size stable if the flexbox is single-line or a single line of multi-line.)
* Proposal B: Stays in box tree, but removes all impact on layout, period. (Just like display:none, but still generates boxes, so animations/counters/etc are unaffected.)
* Proposal C: ?
==== Flex Property ====
- [RESOLVED] Split flex as shorthand of flex-grow/flex-shrink/flex-basis
- [RESOLVED] Does box-sizing affect flex-basis? http://www.w3.org/mid/57440D3E-FD1B-4526-91AD-0898C6AAB3AA@philipwalton.com
- [RESOLVED] Applicability of flex-basis: is it used or ignored for flex == 0?
* Alex suggests it is ignored. This would make main sizing source property different iff flex-grow == flex-shrink == 0.
* http://www.w3.org/mid/D51C9E849DDD0D4EA38C2E539856928412EB4BF0@TK5EX14MBXC214.redmond.corp.microsoft.com
* http://www.w3.org/mid/D51C9E849DDD0D4EA38C2E539856928412EB55DC@TK5EX14MBXC214.redmond.corp.microsoft.com
- [RESOLVED] Default flexibility of flex items: flexible or inflexible? http://www.w3.org/mid/4F91E0D6.7040502@inkedblade.net
* Note: This decision sets the initial values of flex-grow and flex-shrink, which conventionally also implies their default values in the flex shorthand.
- [RESOLVED] What is the computed value of 'flex-basis' when it is 'auto'? Is it ''auto'' or is it the used flex basis? http://www.w3.org/mid/4FA1C498.2040101@inkedblade.net
==== Flex/Main Sizing ====
- [RESOLVED] Negative Flex: use Alex's alternate formulation
* http://www.w3.org/mid/2C86A15F63CD734EB1D846A0BA4E0FC81A3EDD72@CH1PRD0310MB381.namprd03.prod.outlook.com
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16856
- [RESOLVED] Turn negative flex on by default (now that negative flexing makes sense...)
* This means that in a single-line flexbox, auto-sized flex items with long text will shrink so that they don't overflow the flexbox; instead, they become narrower and the text wraps. This seems like what we'd want.
* Multi-line flexbox items still won't shrink unless they're wider than the flexbox.
- [RESOLVED] Implied min-content minimum size for flexbox items
* Now that we have a reasonable negative flex by default, we should have a reasonable minimum main size to go with it.
* Note: IE10 implies min-content as the minimum.
* Note: Could introduce an initial value of 'auto' for 'min-content' to have this make more sense. This would compute to '0' wherever needed for back-compat.
==== Pagination ====
- [RESOLVED] Propagating break-before/after to flex line instead of allowing items to break lines, but only in fragmenting contexts
* http://www.w3.org/mid/4FA150C0.7080605@inkedblade.net
- Allowing pull-up in addition to push-down in paging.
* http://www.w3.org/mid/4FA02EB0.7020102@inkedblade.net
- [RESOLVED] Make paging algorithms informative: define multi-col nature of multi-line column pagination, and otherwise merely advise to minimize distortion.
==== Alignment and Cross-Sizing ====
- [RESOLVED] Single-line vs. multi-line differences in alignment and sizing?
* http://www.w3.org/mid/4F9F6C6E.3020507@inkedblade.net
* http://www.w3.org/mid/2C86A15F63CD734EB1D846A0BA4E0FC81A3EE2FD@CH1PRD0310MB381.namprd03.prod.outlook.com
- [CLOSED] Stretch doesn't allow shrinkage, is that what's wanted?
* http://www.w3.org/mid/87wr4tafju.fsf@aeneas.oslo.osa
- [CLOSED] Get WG approval of 'auto' margin behavior (which is designed to match Grid atm)
* http://lists.w3.org/Archives/Public/www-style/2012May/0347.html
* Also: https://www.w3.org/Bugs/Public/show_bug.cgi?id=16755
- [CLOSED] 'distribute' behavior doesn't match use case that prompted it
* http://www.w3.org/mid/BLU165-ds157576DC1F28A7EF906F2DF8BD0@phx.gbl
- [CLOSED?] Define/resolve on alignment fallbacks for baseline, stretch, distribute, justify.
- [OPEN] True centering vs. safe centering
==== Terminology and Naming ====
- [RESOLVED] Rename 'display: flexbox' to 'display: flex'
* http://www.w3.org/mid/4F8C9537.1060009@moonhenge.net
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16752
- [RESOLVED] Rename "flexbox" to "flex container" and "flexbox item" to "flex item" or "flex box" to be consistent with CSS terminology elsewhere
* http://www.w3.org/mid/4F8322B2.40409@inkedblade.net
- [OPEN] Rename 'flex-order' to 'box-order' or 'display-order', since it doesn't affect order of flexing, but order of boxes.
* Note: this also allows re-use of the property in e.g. grid auto-placement.
* http://www.w3.org/mid/4F3CFBA9.7020200@inkedblade.net
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16756
- [RESOLVED] Resolve nowrap vs. no-wrap for both Flexbox and CSS3 Text
* http://www.w3.org/mid/4F90D9E2.8060404@inkedblade.net
==== Syntactic Alignment of Flex Item Alignment ====
These issues tie into the Box Alignment proposal. [1]
- 'distribute' vs. 'justify': unclear which is which. Also names should not be inconsistent with text / ruby-align, at the very least.
- Flex-flow-relative alignment: start/end/start/end vs. start/end/before/after https://www.w3.org/Bugs/Public/show_bug.cgi?id=16007
- Alignment property names are confusing to anyone who hasn't been working on Flexbox for months.
- [RESOLVED] Proposal for common alignment: if we're going there, how do we integrate with Flexbox without depending on its completion?
===== Resolved Issues =====
==== Issue 1 ====
;URL : http://lists.w3.org/Archives/Public/www-style/2011Jun/thread.html#msg37
;Summary : Multiline flexbox is missing from current draft
2009 spec had a multiline option [[http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#multiple]] which is not supported by current draft.
;Proposal : http://lists.w3.org/Archives/Public/www-style/2011Jun/0303.html
flex-wrap: no-wrap | wrap | balance
or
flex-lines: single | multiple
;Status: Resolved:
flex-wrap: no-wrap | wrap
('balance') is not included into the spec yet. Can keep it as an issue until there is a strong need for it.
==== Issue 2 ====
;URL : //todo//
;Summary : flex-direction property doesn't extend to more values needed for multiline flexbox
Multiline flexbox needs at least 4 bits to choose from directional options (can be more to tie to writing mode, but not less):
- horizontal or vertical primary direction
- horizontal or vertical transverse direction
- single line or multiple lines
- horizontal or vertical line progression
Current draft combines orientation and direction in one property [[http://dev.w3.org/csswg/css3-flexbox/#flex-direction0]], it works well for common cases but does not easily extent to multiline situation.
;Proposal : Some options for adding multiline are listed here: [[http://lists.w3.org/Archives/Public/www-style/2011Jun/0116.html]] - options 1 to 6
;Proposal : http://lists.w3.org/Archives/Public/www-style/2011Jun/0134.html -- best proposal so far (from Fantasai)
Option 7:
flex-orientation: rows | columns | horizontal | vertical
flex-wrap: no-wrap | wrap | balance*
flex-direction: [ forward | backward ] || reverse-stack
(this doesn't include "line-progression")
;Proposal : http://lists.w3.org/Archives/Public/www-style/2011Jul/0406.html
Option 7 take II:
flex-wrap: no-wrap | wrap | balance
flex-flow: [ rows | columns | horizontal | vertical ] || [ reverse-line || reverse-wrap ]
|
[ ltr | rtl | auto ] || [ ttb | btt | auto ]
Examples:
flex-flow: rows; /* forwards inline row (default) */
flex-flow: horizontal; /* forwards horizontal row */
flex-flow: reverse-line; /* backwards inline row */
flex-flow: reverse-wrap; /* reverse-stacking forwards inline rows */
flex-flow: reverse-line vertical; /* backwards vertical column */
flex-flow: reverse-line columns; /* backwards block-oriented column */
flex-flow: ltr; /* horizontal ltr row, auto stacking */
flex-flow: ltr auto; /* same thing */
flex-flow: ttb; /* vertical ttb column, auto stacking */
flex-flow: ltr ttb; /* horizontal ltr row, ttb stacking */
flex-flow: auto ttb; /* horizontal auto row, ttb stacking */
Any missing directions are taken from the writing mode. Forwards for
a particular dimension is matching the block or inline direction
(whichever) is appropriate.
;Proposal : http://lists.w3.org/Archives/Public/www-style/2011Jul/0422.html
Option 7.3 (one property)
flex-flow: [ rows | columns | horizontal | vertical ] ||
[ normal | reverse | ltr | rtl | ttb | btt ] ||
[ wrap | wrap-reverse | wrap-ltr | wrap-rtl | wrap-ttb | wrap-btt ]
Option 7.4
flex-flow: [ rows | columns | horizontal | vertical ] ||
[ normal | reverse | ltr | rtl | ttb | btt ] ||
[ wrap | wrap-reverse | wrap-left | wrap-right | wrap-down| wrap-up ]
;Proposal : http://lists.w3.org/Archives/Public/www-style/2011Jul/0487.html
Option 8:
flex-flow:
[ row | row-reverse | column | column-reverse ] || [ wrap | wrap-reverse ] |
[ horizontal | horizontal-reverse | horizontal-ltr| horizontal-rtl ] &&
[ wrap| wrap-reverse | wrap-down| wrap-up ]? |
[ vertical| vertical-reverse| vertical-ttb| vertical-btt ] &&
[ wrap | wrap-reverse | wrap-left | wrap-right ]?
;Status : Resolved
see spec
==== Issue 3 ====
;URL : //todo//
;Summary : flexbox has two ways to align in transverse direction - confusing and still incomplete. Try to make it consistent with Grid and/or Table.
2009 spec had box-align property with values similar to vertical-align in table cells (start/end/center/stretch/baseline). Current spec adds alignment via auto margins and padding, however 'flex-align' property remains, just for baseline alignment. Having two ways to align, both incomplete, is inconsistent and confusing.
It may be OK, if margin-based alignment is more powerful, having two ways to align may be justified. At this point however, margin-based alignment (using "margin:auto") doesn't provide any new ways of alignment that were not possible with flex-align property.
Historically, it was proposed that margins can have flex values, which
Alignment via margins doesn't really add new ways of alignment that were not possible before the change
;Proposal : http://lists.w3.org/Archives/Public/www-style/2011Jun/0159.html
;Status : Resolved at Seattle F2F to converge both flexbox and grid cell alignment to 2009 spec -- auto margins work, if no auto margins before/after/stretch have effect
;Action : include text in flex-align definition that explains that auto margins are handled before 'flex-align' value is considered. Details can be in layout algorithm or elaborate description as in 2009 spec (http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment)
**Action completed**
==== Issue 4 ====
;URL : http://lists.w3.org/Archives/Public/www-style/2011May/0271.html
;Summary : consider 'true-center' as an align option for flexbox
'true-center' has been proposed many times and has dedicated supporters. Now that flexbox is adding a number of special layout rules and unique behavior, including new kinds of alignment, why not include true-center? There is no need to describe why it can be very useful.
;Status : Resolved: not in flexbox spec. consider for css3 box model
==== Issue 5 ====
;URL : //todo//
;Summary : page breaking behavior needs to be defined for flexbox
flexbox spec says nothing about what happens when flexbox intersects page boundaries. it is reasonable to expect that flexbox is used at high level of page layout (as to positioning side-by-side content columns or headers/footnotes), then it is critical that pages using flexbox layout print reasonably.
;Status : Action Alex: propose
==== Issue 6 ====
;URL : //todo//
;Summary : 'inline-' display values work around limitations of 'display' property semantics. Separate properties for element placement and element content layout are long overdue.
From flexbox spec draft:
ISSUE: The proliferation of "inline-*" display values is untenable and restrictive. Table cells should be able to use the flexbox layout mode for their contents, for example, rather than being forced to use block layout. It's expected that this will be fixed by splitting the ‘display’ property into sub-properties controlling how the element formats its contents (‘display-inside’) and how it reacts to its surroundings (‘display-outside’). Once that occurs, this section will instead describe a single new ‘display-inside’ value that triggers flexbox layout.
;Status : Resolved : this is a change for CSS3-BOX; need proposal, Tab: ACTION-342: define use cases that require 'display-inline'
==== Issue 7 ====
;URL : //todo//
;Summary : Is 'float' property on flex items ignored or honored and wrapped into anonymous block?
Floats are also out-of-flow, but children of flexboxes can't float. Issue:(ISSUE: Should this restriction exist, or should I just wrap floats in the anonymous boxes like other inlines?)
;Status : Resolved: 'float' is ignored on flexbox items. ED updated.
==== Issue 8 ====
;URL : http://dev.w3.org/csswg/css3-flexbox/#flex-order0
;Summary : would 'flex-order' be more intuitive if named 'flex-index'?
'flex-index' would be more consistent with 'z-index'
;Proposal : keep 'flex-order'.
Flexbox literally reorders its children for all purposes, naming is appropriate
http://lists.w3.org/Archives/Public/www-style/2011Aug/0217.html
;Status : Resolved
==== Issue 9 ====
;URL : //todo//
;Summary : multiline flexbox needs properties to control line stacking direction and line pack
This applies to both 2009 and current specs: it is not defined in which direction lines are to be added.
It is reasonable to expect that default line progression matches current writing mode, but it should also allow explicit control.
Similarly, there should be a way to control how lines are distributed if there is more available space than needed, similarly to 'flex-pack'.
;Proposal :
flex-line-progression: normal | reverse
flex-line-pack: before | after | middle | distribute
;Status : Resolved 'flex-line-pack' http://dev.w3.org/csswg/css3-flexbox/#flex-line-pack0
==== Issue 10 ====
;URL : http://dev.w3.org/csswg/css3-flexbox/#display-flexbox
;Summary : "flex item" definition needs precise rules on handling absolute-positioned children
;Proposal :
abspos elements leave behind a placeholder, which is then treated like a 0x0 inline element.
This is important for display types that wrap inappropriately-displayed items, like display:table or display:flexbox.
In other words, doing this:
flex-flow: stack;
Children replaced one on top another. Intrinsic dimensions of
flex-flow: stack; container are equal to tallest/widest child dimensions.
;Status : Resolved: not appropriate for flexbox, due to alignment only applicable to one direction at a time. Grid layout behaves as stack when items don't specify rows/columns.
==== Issue 13 ====
;URL : http://dev.w3.org/csswg/css3-flexbox/#flex-function
;Summary : default values in flex() function should be the initial values
Current spec says: "If flex() function has a single value and it is a