@@ -4092,7 +4092,7 @@ Gutters: the 'row-gap', 'column-gap', and 'gap' properties</h3>
40924092
40934093 Note: Additional spacing may be added between tracks
40944094 due to 'justify-content' /'align-content' .
4095- See [[#algo-overview ]] .
4095+ See [[#algo-grid-sizing ]] .
40964096 This space effectively increases the size of the <a>gutters</a> .
40974097
40984098 If a <a>grid</a> is <a>fragmented</a> between tracks,
@@ -4325,10 +4325,48 @@ Grid Container Baselines</h3>
43254325 ██████ ████ ████████ ████ ██ ██ ██████
43264326-->
43274327
4328- <h2 id='layout-algorithm'>
4329- Grid Sizing </h2>
4328+ <h2 id='layout-algorithm' oldids="algo-overview" dfn export >
4329+ Grid Layout Algorithm </h2>
43304330
4331- This section defines the <dfn export>grid sizing algorithm</dfn> ,
4331+ This section defines the <b> grid layout algorithm</b> ,
4332+ which sizes the [=grid container=] ,
4333+ sizes and positions all the [=grid tracks=] ,
4334+ and lays out the [=grid items=]
4335+ which have been [=grid item placement algorithm|placed=] into its [=grid areas=] .
4336+
4337+ 1. First, find the size of the [=grid container=] ,
4338+ per [[#intrinsic-sizes]] .
4339+
4340+ Note: During this phase,
4341+ cyclic <<percentage>> s in track sizes are treated as ''grid-template-columns/auto'' .
4342+
4343+ 2. Given the resulting [=grid container=] size,
4344+ run the [=Grid Sizing Algorithm=]
4345+ to size the [=grid=] .
4346+
4347+ Note: During this phase,
4348+ <<percentage>> s in track sizes are resolved
4349+ against the [=grid container=] size.
4350+
4351+ 3. Lay out the [=grid items=] into their respective containing blocks.
4352+ Each [=grid area's=] width and height
4353+ are considered [=definite=] for this purpose.
4354+
4355+ Note: Since formulas calculated using only definite sizes,
4356+ such as the [=stretch fit=] formula,
4357+ are also definite,
4358+ the size of a grid item which is stretched
4359+ is also considered definite.
4360+
4361+ Note: Placement of all [=grid items=] ,
4362+ including [=subgrids=] and their sub-items,
4363+ occurs before sizing.
4364+
4365+
4366+ <h3 id="algo-grid-sizing" dfn export>
4367+ Grid Sizing Algorithm</h3>
4368+
4369+ This section defines the <b> grid sizing algorithm</b> ,
43324370 which determines the size of all <a>grid tracks</a>
43334371 and, by extension, the entire grid.
43344372
@@ -4345,13 +4383,6 @@ Grid Sizing</h2>
43454383
43464384 The <a>grid sizing algorithm</a> defines how to resolve these sizing constraints into used track sizes.
43474385
4348- <h3 id="algo-overview">
4349- Grid Sizing Algorithm</h3>
4350-
4351- Note: Placement of all [=grid items=] ,
4352- including [=subgrids=] and their sub-items,
4353- occurs before sizing.
4354-
43554386 <ol>
43564387 <li>
43574388 First, the <a>track sizing algorithm</a> is used to resolve the sizes of the <a>grid columns</a> .
@@ -4462,9 +4493,7 @@ Grid Sizing Algorithm</h3>
44624493 to account for the effective column gap sizes.
44634494
44644495 <li>
4465- Finally, the <a>grid container</a> is sized
4466- using the resulting size of the <a>grid</a> as its content size,
4467- and the tracks are aligned within the <a>grid container</a>
4496+ Finally, align the tracks within the <a>grid container</a>
44684497 according to the 'align-content' and 'justify-content' properties.
44694498
44704499 Note: This can introduce extra space between tracks,
@@ -4481,16 +4510,6 @@ Grid Sizing Algorithm</h3>
44814510 Note this means that a [=subgrid=] establishing an [=orthogonal flow=]
44824511 would have the order of its track sizing inverted compared to a nested grid.
44834512
4484- Once the size of each <a>grid area</a> is thus established,
4485- the <a>grid items</a> are laid out into their respective containing blocks.
4486- The <a>grid area’s</a> width and height are considered <a>definite</a> for this purpose.
4487-
4488- Note: Since formulas calculated using only definite sizes,
4489- such as the <a>stretch fit</a> formula,
4490- are also definite,
4491- the size of a grid item which is stretched
4492- is also considered definite.
4493-
44944513 <div class="example">
44954514 The following example illustrates how per-axis subgrids are sized:
44964515
@@ -5391,17 +5410,18 @@ Changes</h2>
53915410Changes since the <a href="https://www.w3.org/TR/2020/CRD-css-grid-2-20201218/">18 December 2020 CR</a></h3>
53925411
53935412 <ul class="non-normative">
5394- Clarified how [=relative positioning=] applies to [=subgrids=] .
5395- (<a href="https://github.com/w3c/csswg-drafts/issues/7123">Issue 7123</a> )
5396- <blockquote>
5397- <ul>
5398- <li>
5399- <ins> [=Relative positioning=] applies to <a>subgrids</a> as normal,
5400- and shifts the box and its content together as usual.
5401- (Note: Relative positioning takes place after alignment,
5402- and does not affect track sizing.)</ins>
5403- </ul>
5404- </blockquote>
5413+ <li>
5414+ Clarified how [=relative positioning=] applies to [=subgrids=] .
5415+ (<a href="https://github.com/w3c/csswg-drafts/issues/7123">Issue 7123</a> )
5416+ <blockquote>
5417+ <ul>
5418+ <li>
5419+ <ins> [=Relative positioning=] applies to <a>subgrids</a> as normal,
5420+ and shifts the box and its content together as usual.
5421+ (Note: Relative positioning takes place after alignment,
5422+ and does not affect track sizing.)</ins>
5423+ </ul>
5424+ </blockquote>
54055425
54065426 <li id="change-2020-flex-intrinsic-ratios">
54075427 Changed intrinsic track space distribution <a href="#algo-spanning-flex-items">across flexible tracks</a>
@@ -5499,6 +5519,14 @@ Changes since the <a href="https://www.w3.org/TR/2020/CRD-css-grid-2-20201218/">
54995519 <del> However, if the <a>grid container</a> parent is also the generator of the absolutely positioned element's <a>containing block</a> ,
55005520 instead use the <a>grid area</a> determined in [[#abspos-items]] .</del>
55015521 </blockquote>
5522+
5523+ <li id="change-2020-rearrange-layout-algo">
5524+ Rearranged the Grid Sizing Algorithm overview
5525+ to better convey the relationship
5526+ between grid container sizing
5527+ and grid track sizing.
5528+ See [[#layout-algorithm]] .
5529+ (<a href="https://github.com/w3c/csswg-drafts/issues/3418">Issue 3418</a> )
55025530 </ul>
55035531
55045532<h3 id="changes-202008">
0 commit comments