Skip to content

Commit 22b395c

Browse files
committed
[css-grid] Add Rachel Andrew's example of spanning+distribution.
1 parent 157c17d commit 22b395c

3 files changed

Lines changed: 39 additions & 1 deletion

File tree

css-grid/Overview.bs

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3390,7 +3390,45 @@ Aligning the Grid: the 'justify-content' and 'align-content' properties</h3>
33903390
If the <a>grid</a> is <a>fragmented</a> between tracks,
33913391
any such additional spacing between those tracks must be suppressed.
33923392

3393-
Issue: Add example of fixed size spanner getting extra space from content-distribution.
3393+
<div class="example">
3394+
For example, in the following grid,
3395+
the spanning item’s grid area is increased to accommodate
3396+
the extra space assigned to the gutters due to alignment:
3397+
3398+
<pre>
3399+
.wrapper {
3400+
display: grid;
3401+
&hellip; 4-column / 3-row grid container &hellip;
3402+
grid-gap: 10px;
3403+
align-content: space-around;
3404+
justify-content: space-between;
3405+
}
3406+
3407+
.item1 { grid-column: 1 / 5; }
3408+
.item2 { grid-column: 1 / 3; grid-row: 2 / 4; }
3409+
.item3 { grid-column: 3 / 5; }
3410+
/* last two items auto-place into the last two grid cells */
3411+
</pre>
3412+
3413+
<figure>
3414+
<img src="images/spanned-gap.png"
3415+
alt="Grid with 10px gap and an element spanning all columns.
3416+
The sum of the columns is less than the width of the grid container.">
3417+
<figcaption>Grid before alignment</figure>
3418+
</figure>
3419+
<figure>
3420+
<img src="images/spanned-gap-align.png"
3421+
alt="Same grid with increased gaps absorbing the excess grid containe width.
3422+
The spanning element has grown to accommodate the extra space assigned to the gap it crosses.">
3423+
<figcaption>Grid after alignment</figure>
3424+
</figure>
3425+
3426+
Note that alignment (unlike 'grid-gap' spacing)
3427+
happens after the grid tracks are sized,
3428+
so if the track sizes are determined by the contents of the spanned item,
3429+
it will gain excess space in the alignment stage
3430+
to accommodate the alignment spacing.
3431+
</div>
33943432

33953433
<h3 id='grid-baselines'>
33963434
Grid Container Baselines</h3>
5.4 KB
Loading

css-grid/images/spanned-gap.png

5.2 KB
Loading

0 commit comments

Comments
 (0)