@@ -4092,7 +4092,7 @@ Gutters: the 'row-gap', 'column-gap', and 'gap' properties</h3>
4092
4092
4093
4093
Note: Additional spacing may be added between tracks
4094
4094
due to 'justify-content' /'align-content' .
4095
- See [[#algo-overview ]] .
4095
+ See [[#algo-grid-sizing ]] .
4096
4096
This space effectively increases the size of the <a>gutters</a> .
4097
4097
4098
4098
If a <a>grid</a> is <a>fragmented</a> between tracks,
@@ -4325,10 +4325,48 @@ Grid Container Baselines</h3>
4325
4325
██████ ████ ████████ ████ ██ ██ ██████
4326
4326
-->
4327
4327
4328
- <h2 id='layout-algorithm'>
4329
- Grid Sizing </h2>
4328
+ <h2 id='layout-algorithm' oldids="algo-overview" dfn export >
4329
+ Grid Layout Algorithm </h2>
4330
4330
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> ,
4332
4370
which determines the size of all <a>grid tracks</a>
4333
4371
and, by extension, the entire grid.
4334
4372
@@ -4345,13 +4383,6 @@ Grid Sizing</h2>
4345
4383
4346
4384
The <a>grid sizing algorithm</a> defines how to resolve these sizing constraints into used track sizes.
4347
4385
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
-
4355
4386
<ol>
4356
4387
<li>
4357
4388
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>
4462
4493
to account for the effective column gap sizes.
4463
4494
4464
4495
<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>
4468
4497
according to the 'align-content' and 'justify-content' properties.
4469
4498
4470
4499
Note: This can introduce extra space between tracks,
@@ -4481,16 +4510,6 @@ Grid Sizing Algorithm</h3>
4481
4510
Note this means that a [=subgrid=] establishing an [=orthogonal flow=]
4482
4511
would have the order of its track sizing inverted compared to a nested grid.
4483
4512
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
-
4494
4513
<div class="example">
4495
4514
The following example illustrates how per-axis subgrids are sized:
4496
4515
@@ -5391,17 +5410,18 @@ Changes</h2>
5391
5410
Changes since the <a href="https://www.w3.org/TR/2020/CRD-css-grid-2-20201218/">18 December 2020 CR</a></h3>
5392
5411
5393
5412
<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>
5405
5425
5406
5426
<li id="change-2020-flex-intrinsic-ratios">
5407
5427
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/">
5499
5519
<del> However, if the <a>grid container</a> parent is also the generator of the absolutely positioned element's <a>containing block</a> ,
5500
5520
instead use the <a>grid area</a> determined in [[#abspos-items]] .</del>
5501
5521
</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> )
5502
5530
</ul>
5503
5531
5504
5532
<h3 id="changes-202008">
0 commit comments