Skip to content

Commit b602956

Browse files
committed
[css-grid] Specify how justify-content/align-content work.
1 parent 64aa698 commit b602956

2 files changed

Lines changed: 53 additions & 12 deletions

File tree

css-grid/Overview.html

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ <h2 class="no-num no-toc no-ref heading settled heading" id=contents><span class
137137
Alignment</a><ul class=toc><li><a href=#auto-margins><span class=secno>9.1</span>
138138
Aligning with <span data-link-for=margin data-link-type=value title=auto>auto</span> margins</a><li><a href=#row-align><span class=secno>9.2</span>
139139
Row-axis Alignment: the <span class=property data-link-type=propdesc title=justify-self>justify-self</span> and <span class=property data-link-type=propdesc title=justify-items>justify-items</span> properties</a><li><a href=#column-align><span class=secno>9.3</span>
140-
Column-axis Alignment: the <span class=property data-link-type=propdesc title=align-self>align-self</span> and <span class=property data-link-type=propdesc title=align-items>align-items</span> properties</a><li><a href=#z-order><span class=secno>9.4</span>
141-
Z-axis Ordering: the <span class=property data-link-type=propdesc title=z-index>z-index</span> property</a><li><a href=#grid-baselines><span class=secno>9.5</span>
140+
Column-axis Alignment: the <span class=property data-link-type=propdesc title=align-self>align-self</span> and <span class=property data-link-type=propdesc title=align-items>align-items</span> properties</a><li><a href=#grid-align><span class=secno>9.4</span>
141+
Aligning the Grid: the <span class=property data-link-type=propdesc title=justify-content>justify-content</span> and <span class=property data-link-type=propdesc title=align-content>align-content</span> properties</a><li><a href=#z-order><span class=secno>9.5</span>
142+
Z-axis Ordering: the <span class=property data-link-type=propdesc title=z-index>z-index</span> property</a><li><a href=#grid-baselines><span class=secno>9.6</span>
142143
Grid Baselines</a></ul><li><a href=#layout-algorithm><span class=secno>10</span>
143144
Grid Layout Algorithm</a><ul class=toc><li><a href=#algo-terms><span class=secno>10.1</span>
144145
Definition of Terms for use in Calculating Grid Track Sizes</a><li><a href=#track-sizing-algorithm><span class=secno>10.2</span>
@@ -2190,7 +2191,7 @@ <h3 class="heading settled heading" data-level=8.4 id=abspos-items><span class=s
21902191
do not take up space or otherwise participate in the layout of the grid.
21912192

21922193
<div class=example>
2193-
<pre class=example> .grid {
2194+
<pre> .grid {
21942195
display: grid;
21952196
grid: ...;
21962197
position: relative; /* containing block */
@@ -2206,7 +2207,7 @@ <h3 class="heading settled heading" data-level=8.4 id=abspos-items><span class=s
22062207
}
22072208
</pre> </div>
22082209

2209-
<p class=issue id=issue-382f79cc><a class=self-link href=#issue-382f79cc></a>
2210+
<div class=issue id=issue-40e1e2b2><a class=self-link href=#issue-40e1e2b2></a>
22102211
<ul>
22112212
<li>Simple example of abspos spanning the whole grid.
22122213
<li>Example of abspos spanning a portion of the grid.
@@ -2220,6 +2221,7 @@ <h3 class="heading settled heading" data-level=8.4 id=abspos-items><span class=s
22202221
grid-column: auto / span 2;
22212222
}
22222223
</pre> </ul>
2224+
</div>
22232225

22242226
<h2 class="heading settled heading" data-level=9 id=alignment><span class=secno>9 </span><span class=content>
22252227
Alignment</span><a class=self-link href=#alignment></a></h2>
@@ -2307,7 +2309,17 @@ <h3 class="heading settled heading" data-level=9.3 id=column-align><span class=s
23072309
or <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-align-3/#align-items title=align-items>align-items</a> property on the <a data-link-type=dfn href=#grid-container title="grid container">grid container</a>,
23082310
as defined in <a data-biblio-type=normative data-link-type=biblio href=#css3-align title=css3-align>[CSS3-ALIGN]</a>.
23092311

2310-
<h3 class="heading settled heading" data-level=9.4 id=z-order><span class=secno>9.4 </span><span class=content>
2312+
<h3 class="heading settled heading" data-level=9.4 id=grid-align><span class=secno>9.4 </span><span class=content>
2313+
Aligning the Grid: the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-align-3/#justify-content title=justify-content>justify-content</a> and <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-align-3/#align-content title=align-content>align-content</a> properties</span><a class=self-link href=#grid-align></a></h3>
2314+
2315+
<p> If the <a data-link-type=dfn href=#grid title=grid>grid</a>’s outer edges do not correspond to the <a data-link-type=dfn href=#grid-container title="grid container">grid container</a>’s padding edges
2316+
(for example, if no columns are flex-sized),
2317+
the <a data-link-type=dfn href=#grid title=grid>grid</a> is aligned within the padding box according to the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-align-3/#justify-content title=justify-content>justify-content</a> and <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-align-3/#align-content title=align-content>align-content</a> properties on the <a data-link-type=dfn href=#grid-container title="grid container">grid container</a>.
2318+
2319+
<p class=issue id=issue-3ca79b56><a class=self-link href=#issue-3ca79b56></a>
2320+
Provide a picture as example.
2321+
2322+
<h3 class="heading settled heading" data-level=9.5 id=z-order><span class=secno>9.5 </span><span class=content>
23112323
Z-axis Ordering: the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-position-3/#z-index title=z-index>z-index</a> property</span><a class=self-link href=#z-order></a></h3>
23122324

23132325

@@ -2362,7 +2374,7 @@ <h3 class="heading settled heading" data-level=9.4 id=z-order><span class=secno>
23622374
&lt;div id="E"&gt;E&lt;/div&gt;
23632375
&lt;/div&gt;</pre> </div>
23642376

2365-
<h3 class="heading settled heading" data-level=9.5 id=grid-baselines><span class=secno>9.5 </span><span class=content>
2377+
<h3 class="heading settled heading" data-level=9.6 id=grid-baselines><span class=secno>9.6 </span><span class=content>
23662378
Grid Baselines</span><a class=self-link href=#grid-baselines></a></h3>
23672379

23682380
<p>
@@ -3154,8 +3166,8 @@ <h2 class="no-num no-ref heading settled heading" id=index><span class=content>
31543166
<li>value for grid-template, <a href=#valuedef-none2 title="section 5.3">5.3</a>
31553167
<li>value for grid-auto-flow, <a href=#valuedef-none title="section 6.2">6.2</a>
31563168
</ul><li>occupied grid cell, <a href=#occupied-grid-cell title="section 6.2.1">6.2.1</a>
3157-
<li>order-modified grid order, <a href=#order-modified-grid-order title="section 9.5">9.5</a>
3158-
<li>participates in baseline alignment, <a href=#baseline-participation title="section 9.5">9.5</a>
3169+
<li>order-modified grid order, <a href=#order-modified-grid-order title="section 9.6">9.6</a>
3170+
<li>participates in baseline alignment, <a href=#baseline-participation title="section 9.6">9.6</a>
31593171
<li>&lt;percentage&gt;, <a href=#valuedef-percentage title="section 5.1">5.1</a>
31603172
<li>placement, <a href=#grid-placementplacement title="section 8">8</a>
31613173
<li>RemainingSpace, <a href=#RemainingSpace-definition title="section 10.1">10.1</a>
@@ -3223,8 +3235,26 @@ <h2 class="no-num heading settled" id=issues-index><span class=content>Issues In
32233235
Should <a class=property data-link-type=propdesc href=#propdef-grid-area title=grid-area>grid-area</a> be <a class=property data-link-type=propdesc title=grid-field>grid-field</a>?
32243236

32253237

3226-
<a href=#issue-6466e536></a><p class=issue>
3227-
<a href=#issue-382f79cc></a><p class=issue>
3238+
<a href=#issue-6466e536></a><div class=issue>
3239+
<ul>
3240+
<li>Simple example of abspos spanning the whole grid.
3241+
<li>Example of abspos spanning a portion of the grid.
3242+
<li>Example of abspos using its offsets.
3243+
<li>Complex example of a centered grid interacting with abspos doing both padding-edge and explicit lines.
3244+
<pre> .grid {
3245+
justify-content: center;
3246+
}
3247+
.abspos {
3248+
grid-row: 2 / -1;
3249+
grid-column: auto / span 2;
3250+
}
3251+
</pre> </ul>
3252+
<a href=#issue-40e1e2b2></a></div>
3253+
3254+
<p class=issue>
3255+
Provide a picture as example.
3256+
3257+
<a href=#issue-3ca79b56></a><p class=issue>
32283258
Currently this algorithm embodies several heuristics which regulate the growth of spanning <a data-link-type=dfn href=#grid-item title="grid items">Grid items</a> to accommodate certain use cases. (E.g. the game example in Figures 2 and 3 above.) These heuristics should be a normative part of this specification to ensure interoperability. To the extent additional use cases can be identified that cannot be satisfied by following the current heuristics, the normative algorithm can be updated, or additional mechanisms can be introduced for fine-grained control of content-based TrackSizingFunction.
32293259

32303260
<a href=#issue-a01f80c8></a><p class=issue>

css-grid/Overview.src.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ <h3 id="abspos-items">
22852285
do not take up space or otherwise participate in the layout of the grid.
22862286

22872287
<div class='example'>
2288-
<pre class='example'>
2288+
<pre>
22892289
.grid {
22902290
display: grid;
22912291
grid: ...;
@@ -2303,7 +2303,7 @@ <h3 id="abspos-items">
23032303
</pre>
23042304
</div>
23052305

2306-
<p class='issue'>
2306+
<div class='issue'>
23072307
<ul>
23082308
<li>Simple example of abspos spanning the whole grid.
23092309
<li>Example of abspos spanning a portion of the grid.
@@ -2319,6 +2319,7 @@ <h3 id="abspos-items">
23192319
}
23202320
</pre>
23212321
</ul>
2322+
</div>
23222323

23232324
<h2 id='alignment'>
23242325
Alignment</h2>
@@ -2408,6 +2409,16 @@ <h3 id='column-align'>
24082409
or 'align-items' property on the <a>grid container</a>,
24092410
as defined in [[!CSS3-ALIGN]].
24102411

2412+
<h3 id='grid-align'>
2413+
Aligning the Grid: the 'justify-content' and 'align-content' properties</h3>
2414+
2415+
If the <a>grid</a>’s outer edges do not correspond to the <a>grid container</a>’s padding edges
2416+
(for example, if no columns are flex-sized),
2417+
the <a>grid</a> is aligned within the padding box according to the 'justify-content' and 'align-content' properties on the <a>grid container</a>.
2418+
2419+
<p class='issue'>
2420+
Provide a picture as example.
2421+
24112422
<h3 id='z-order'>
24122423
Z-axis Ordering: the 'z-index' property</h3>
24132424

0 commit comments

Comments
 (0)