You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Flex Layout Box Model and Terminology</span><aclass=self-linkhref=#box-model></a></h2>
542
542
543
543
<p>
544
-
An element with <aclass=cssdata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display:flex</a> or <aclass=cssdata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display:inline-flex</a> is a <adata-link-type=dfnhref=#flex-containertitle="flex container">flex container</a>.
544
+
A box with <aclass=cssdata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display:flex</a> or <aclass=cssdata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display:inline-flex</a> is a <adata-link-type=dfnhref=#flex-containertitle="flex container">flex container</a>.
545
545
Children of a flex container are called <adata-link-type=dfnhref=#flex-itemtitle="flex items">flex items</a> and are laid out using the flex layout model.
<aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-floattitle=float>float</a> and <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-cleartitle=clear>clear</a> have no effect on a <adata-link-type=dfnhref=#flex-itemtitle="flex item">flex item</a>.
650
650
(However, the <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-floattitle=float>float</a> property still affects the computed value of <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display</a> on children of a flex container,
651
-
as this occurs <emtitle="">before</em><adata-link-type=dfnhref=#flex-itemtitle="flex items">flex items</a> are determined.)
651
+
as this occurs <em>before</em><adata-link-type=dfnhref=#flex-itemtitle="flex items">flex items</a> are determined.)
652
652
653
653
<li>
654
654
<aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-aligntitle=vertical-align>vertical-align</a> has no effect on a flex item.
If an element’s specified <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display</a> is <aclass=cssdata-link-type=maybehref=#valuedef-inline-flextitle=inline-flex>inline-flex</a>
662
-
and the element is floated or absolutely positioned,
661
+
If a box’s specified <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display</a> is <aclass=cssdata-link-type=maybehref=#valuedef-inline-flextitle=inline-flex>inline-flex</a>
662
+
and the box is floated or absolutely positioned,
663
663
the computed value of <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display</a> is <ahref=#display-flex><aclass=cssdata-link-type=maybehref=#valuedef-flextitle=flex>flex</a></a>.
664
664
The table in <ahref=http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo>CSS 2.1 Chapter 9.7</a> is thus amended
The computed <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display</a> of a <adata-link-type=dfnhref=#flex-itemtitle="flex item">flex item</a>
Some values of <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display</a> trigger the generation of anonymous boxes.
728
728
For example, a misparented <spanclass=cssdata-link-type=maybetitle=table-cell>table-cell</span> child is fixed up
729
-
by <ahref=http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes>generating anonymous <spanclass=cssdata-link-type=maybetitle=table>table</span> and <spanclass=cssdata-link-type=maybetitle=table-row>table-row</span>elements</a> around it. <adata-biblio-type=normativedata-link-type=bibliohref=#css21title=css21>[CSS21]</a>
729
+
by <ahref=http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes>generating anonymous <spanclass=cssdata-link-type=maybetitle=table>table</span> and <spanclass=cssdata-link-type=maybetitle=table-row>table-row</span>boxes</a> around it. <adata-biblio-type=normativedata-link-type=bibliohref=#css21title=css21>[CSS21]</a>
730
730
This fixup must occur <em>before</em> a flex container’s children are promoted to <adata-link-type=dfnhref=#flex-itemtitle="flex items">flex items</a>.
731
-
For example, given two contiguous child elements with <aclass=cssdata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display:table-cell</a>,
731
+
For example, given two contiguous child boxes with <aclass=cssdata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display:table-cell</a>,
732
732
an anonymous table wrapper box around them becomes the <adata-link-type=dfnhref=#flex-itemtitle="flex item">flex item</a>.
<p> An absolutely-positioned child element of a <adata-link-type=dfnhref=#flex-containertitle="flex container">flex container</a> does not participate in flex layout
753
+
<p> An absolutely-positioned child of a <adata-link-type=dfnhref=#flex-containertitle="flex container">flex container</a> does not participate in flex layout
754
754
beyond the <ahref=#algo-flex-order>reordering step</a>.
755
755
756
-
<p> Its static position is calculated by first doing full flex layout without the absolutely-positioned elements,
756
+
<p> Its static position is calculated by first doing full flex layout without the absolutely-positioned children,
757
757
then positioning each absolutely-positioned child as if it were the sole <adata-link-type=dfnhref=#flex-itemtitle="flex item">flex item</a>
758
758
in the <adata-link-type=dfnhref=#flex-containertitle="flex container">flex container</a>,
759
-
assuming both the element and the <adata-link-type=dfnhref=#flex-containertitle="flex container">flex container</a> were fixed size boxes of their used size.
759
+
assuming both the child and the <adata-link-type=dfnhref=#flex-containertitle="flex container">flex container</a> were fixed size boxes of their used size.
760
760
761
761
<divclass=example>
762
-
For example, by default, the static position of an absolutely positioned element aligns it to the main-start/cross-start corner,
762
+
For example, by default, the static position of an absolutely positioned child aligns it to the main-start/cross-start corner,
763
763
corresponding to the default values of <aclass=propertydata-link-type=propdeschref=#propdef-justify-contenttitle=justify-content>justify-content</a> and <aclass=propertydata-link-type=propdeschref=#propdef-align-contenttitle=align-content>align-content</a> on the <adata-link-type=dfnhref=#flex-containertitle="flex container">flex container</a>.
764
764
Setting <aclass=cssdata-link-type=propdeschref=#propdef-justify-contenttitle=justify-content>justify-content:center</a> on the <adata-link-type=dfnhref=#flex-containertitle="flex container">flex container</a>, however,
Specifying <aclass=cssdata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visufx.html#propdef-visibilitytitle=visibility>visibility:collapse</a> on a flex item
800
800
causes it to become a <dfndata-dfn-type=dfndata-noexport="" id=collapsed-flex-itemtitle="collapsed flex item|collapsed">collapsed flex item<aclass=self-linkhref=#collapsed-flex-item></a></dfn>,
801
801
producing an effect similar to <aclass=cssdata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visufx.html#propdef-visibilitytitle=visibility>visibility:collapse</a> on a table-row or table-column:
802
-
the collapsed element is removed from rendering entirely,
802
+
the collapsed flex item is removed from rendering entirely,
803
803
but leaves behind a "strut" that keeps the flex line’s cross-size stable.
starting from the lowest numbered ordinal group and going up.
1109
1109
Items with the same ordinal group are laid out in the order they appear in the source document.
1110
1110
This also affects the <ahref=http://www.w3.org/TR/CSS2/zindex.html>painting order</a><adata-biblio-type=normativedata-link-type=bibliohref=#css21title=css21>[CSS21]</a>,
1111
-
exactly as if the elements were reordered in the document.
1111
+
exactly as if the flex items were reordered in the source document.
1112
1112
1113
1113
<divclass=example>
1114
1114
<p>The following figure shows a simple tabbed interface, where the tab for the active pane is always first:
When omitted from the <aclass=propertydata-link-type=propdeschref=#propdef-flextitle=flex>flex</a> shorthand, its specified value is <spanclass=cssdata-link-type=maybetitle=0%>0%</span>.
1372
1372
<p>
1373
1373
If the specified <aclass=propertydata-link-type=propdeschref=#propdef-flex-basistitle=flex-basis>flex-basis</a> is <aclass=css-codedata-link-for=flex-basisdata-link-type=valuehref=#valuedef-auto0title=auto>auto</a>,
1374
-
the used <adata-link-type=dfnhref=#flex-basistitle="flex basis">flex basis</a> is the value of the element’s <adata-link-type=dfnhref=#main-size-propertytitle="main size property">main size property</a>.
1375
-
(This can itself be the keyword <aclass=css-codedata-link-for=widthdata-link-type=valuetitle=auto>auto</a>, which sizes the element based on its contents.)
1374
+
the used <adata-link-type=dfnhref=#flex-basistitle="flex basis">flex basis</a> is the value of the flex item’s <adata-link-type=dfnhref=#main-size-propertytitle="main size property">main size property</a>.
1375
+
(This can itself be the keyword <aclass=css-codedata-link-for=widthdata-link-type=valuetitle=auto>auto</a>, which sizes the flex item based on its contents.)
any positive free space is distributed to auto margins in that dimension.
1559
1559
1560
1560
<li>
1561
-
Overflowing elements ignore their auto margins and overflow in the <adata-link-type=dfnhref=http://dev.w3.org/csswg/css-writing-modes-3/#endtitle=end>end</a> direction.
1561
+
Overflowing boxes ignore their auto margins and overflow in the <adata-link-type=dfnhref=http://dev.w3.org/csswg/css-writing-modes-3/#endtitle=end>end</a> direction.
A value of <dfnclass=css-codedata-dfn-for=align-selfdata-dfn-type=valuedata-export="" id=valuedef-auto>auto<aclass=self-linkhref=#valuedef-auto></a></dfn> for <aclass=propertydata-link-type=propdeschref=#propdef-align-selftitle=align-self>align-self</a>
1738
-
computes to the value of <aclass=propertydata-link-type=propdeschref=#propdef-align-itemstitle=align-items>align-items</a> on the element’s parent,
1739
-
or <aclass=css-codedata-link-for=align-selfdata-link-type=valuehref=#valuedef-stretch0title=stretch>stretch</a> if the element has no parent.
1738
+
computes to the value of <aclass=propertydata-link-type=propdeschref=#propdef-align-itemstitle=align-items>align-items</a> on the flex item’s parent,
1739
+
or <aclass=css-codedata-link-for=align-selfdata-link-type=valuehref=#valuedef-stretch0title=stretch>stretch</a> if the flex item has no parent.
<strong>Re-order the flex items and absolutely positioned flex container children according to their <aclass=propertydata-link-type=propdeschref=#propdef-ordertitle=order>order</a>.</strong>
2018
-
The elements with the lowest (most negative) <aclass=propertydata-link-type=propdeschref=#propdef-ordertitle=order>order</a> values are first in the ordering.
2019
-
If multiple elements share an <aclass=propertydata-link-type=propdeschref=#propdef-ordertitle=order>order</a> value,
2018
+
The flex items with the lowest (most negative) <aclass=propertydata-link-type=propdeschref=#propdef-ordertitle=order>order</a> values are first in the ordering.
2019
+
If multiple flex items share an <aclass=propertydata-link-type=propdeschref=#propdef-ordertitle=order>order</a> value,
2020
2020
they’re ordered by document order.
2021
-
This affects the order in which the elements generate boxes in the box-tree,
2021
+
This effectively changes the order of their boxes in the box-tree,
2022
2022
and how the rest of this algorithm deals with the generated flex items.
The <aclass=css-codedata-link-type=propertyhref=http://dev.w3.org/csswg/css-break-3/#break-beforetitle=break-before>break-*</a> properties apply to flex containers as normal for block-level or inline-level boxes.
2465
2465
This section defines how they apply to flex items
2466
-
and elements inside flex items.
2466
+
and the contents of flex items.
2467
2467
2468
2468
<p>
2469
2469
The following breaking rules refer to the fragmentation container as the “page”.
Absolutely positioned children of a flex container are no longer called "flex items" (to avoid terminology confusion).
2826
2826
<li>
2827
-
Clarified that <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-floattitle=float>float</a> still makes the children of a flex container turn into block-level elements.
2827
+
Clarified that <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-floattitle=float>float</a> still affects the computed <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/CSS21/visuren.html#propdef-displaytitle=display>display</a> (which may affect box-fixup rules that run prior to flex item determination).
2828
2828
<li>
2829
2829
Clarified that table anonymous box generation occurs in place of computed value conversion for internal table elements.
0 commit comments