Skip to content

Commit 129f2c1

Browse files
committed
[css-grid] Make 'auto' track sizing rely on min-size instead of always on min-content. Make min-size: auto affect grid items.
1 parent 58e64cf commit 129f2c1

2 files changed

Lines changed: 108 additions & 416 deletions

File tree

css-grid/Overview.bs

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,12 @@ Grid Items</h2>
662662
except that ''margin/auto'' margins and the <a>box alignment properties</a>
663663
have special effects. (See [[#alignment]].)
664664

665+
The ''min-width/auto'' value of 'min-width' and 'min-height'
666+
behaves on <a>grid items</a> in the relevant axis
667+
analogously to its behavior on <a>flex items</a> in the <a>main axis</a>.
668+
See [[!CSS3-FLEXBOX]].
669+
670+
ISSUE: Review implications of intrinsic ratio and Grid's 2D nature.
665671

666672
<!--
667673
<h3 id="position-grid">
@@ -857,6 +863,9 @@ Track Sizing: the 'grid-template-rows' and 'grid-template-columns' properties</h
857863
Each <<flex>>-sized track takes a share of the remaining space in proportion to its <a>flex factor</a>.
858864
See <a href="#fr-unit">Flexible Lengths</a> for more details.
859865

866+
When appearing outside a ''minmax()'' notation,
867+
implies an automatic minimum (i.e. ''minmax(auto, <<flex>>)'').
868+
860869
<dt><dfn>max-content</dfn>
861870
<dd>
862871
Represents the largest <a>max-content contribution</a>
@@ -880,7 +889,9 @@ Track Sizing: the 'grid-template-rows' and 'grid-template-columns' properties</h
880889

881890
<dt><dfn>auto</dfn>
882891
<dd>
883-
Computes to ''minmax(min-content, max-content)''.
892+
As a maximum, identical to ''max-content''.
893+
As a minimum, represents the largest minimum size (as specified by 'min-width'/'min-height')
894+
of the <a>grid items</a> occupying the <a>grid track</a>.
884895
</dl>
885896

886897
<div class='example'>
@@ -2599,7 +2610,7 @@ Grid Sizing</h2>
25992610

26002611
<ul>
26012612
<li>A <dfn>fixed sizing function</dfn> (<<length>> or resolveable <<percentage>>).
2602-
<li>An <dfn>intrinsic sizing function</dfn> (''min-content'' or ''max-content'').
2613+
<li>An <dfn>intrinsic sizing function</dfn> (''min-content'', ''max-content'', or ''auto'').
26032614
<li>A <dfn>flexible sizing function</dfn> (<<flex>>).
26042615
</ul>
26052616

@@ -2778,38 +2789,53 @@ Resolve Intrinsic Track Sizes</h3>
27782789
If the track has a ''max-content'' <a>min track sizing function</a>,
27792790
set its <a>base size</a>
27802791
to the maximum of the items’ <a>max-content contributions</a>.
2792+
<li>
2793+
<strong>For auto minimums:</strong>
2794+
If the track has an ''auto'' <a>min track sizing function</a>,
2795+
set its <a>base size</a>
2796+
to the maximum of the items’ outer minimum sizes,
2797+
as specified by their respective 'min-width' or 'min-height' properties
2798+
(whichever matches the relevant axis).
27812799
<li>
27822800
<strong>For min-content maximums:</strong>
27832801
If the track has a ''min-content'' <a>max track sizing function</a>,
27842802
set its <a>growth limit</a>
27852803
to the maximum of the items’ <a>min-content contributions</a>.
27862804
<li>
2787-
<strong>For max-content maximums:</strong>
2788-
If the track has a ''max-content'' <a>max track sizing function</a>,
2805+
<strong>For max-content and auto maximums:</strong>
2806+
If the track has a ''max-content'' or ''auto'' <a>max track sizing function</a>,
27892807
set its <a>growth limit</a>
27902808
to the maximum of the items’ <a>max-content contributions</a>.
27912809
</ul>
27922810
<li>
27932811
<strong>Increase sizes to accommodate spanning items:</strong>
27942812
Next, consider the items with a span of 2
27952813
that do not span a track with a <a>flexible sizing function</a>:
2814+
<!-- auto-min contribution <= min-content contribution <= max-content contribution -->
27962815
<ol>
27972816
<li>
27982817
<strong>For intrinsic minimums:</strong>
27992818
First increase the <a>base size</a> of tracks with
2819+
a <a>min track sizing function</a> of ''min-content'', ''max-content'', or ''auto''
2820+
by <a href="#extra-space">distributing extra space</a> as needed
2821+
to accommodate the contributions dictated by these items’
2822+
minimum size (as specified by 'min-width'/'min-height').
2823+
<li>
2824+
<strong>For content-based minimums:</strong>
2825+
Next continue to increase the <a>base size</a> of tracks with
28002826
a <a>min track sizing function</a> of ''min-content'' or ''max-content''
28012827
by <a href="#extra-space">distributing extra space</a> as needed
28022828
to account for these items' <a>min-content contributions</a>.
28032829
<li>
28042830
<strong>For max-content minimums:</strong>
2805-
Next continue to increase the <a>base size</a> of tracks with
2831+
Third continue to increase the <a>base size</a> of tracks with
28062832
a <a>min track sizing function</a> of ''max-content''
28072833
by <a href="#extra-space">distributing extra space</a> as needed
28082834
to account for these items' <a>max-content contributions</a>.
28092835
<li>
28102836
<strong>For intrinsic maximums:</strong>
2811-
Third increase the <a>growth limit</a> of tracks with
2812-
a <a>max track sizing function</a> of ''min-content'' or ''max-content''
2837+
Next increase the <a>growth limit</a> of tracks with
2838+
a <a>max track sizing function</a> of ''min-content'' or ''max-content'' (including ''auto'')
28132839
by <a href="#extra-space">distributing extra space</a> as needed
28142840
to account for these items' <a>min-content contributions</a>.
28152841
Mark any tracks whose <a>growth limit</a> changed
@@ -2819,7 +2845,7 @@ Resolve Intrinsic Track Sizes</h3>
28192845
<li>
28202846
<strong>For max-content maximums:</strong>
28212847
Lastly continue to increase the <a>growth limit</a> of tracks with
2822-
a <a>max track sizing function</a> of ''max-content''
2848+
a <a>max track sizing function</a> of ''max-content'' (including ''auto'')
28232849
by <a href="#extra-space">distributing extra space</a> as needed
28242850
to account for these items' <a>max-content contributions</a>.
28252851
</ol>

0 commit comments

Comments
 (0)