@@ -15,48 +15,51 @@ Abstract: This CSS module defines a two-dimensional grid-based layout system, op
1515Introduction {#intro}
1616=====================
1717
18- This level is currently maintained as a diff spec over the level 1 module [[!CSS-GRID-1]] .
19- It adds the following features:
18+ This level is currently maintained as a diff spec over the level 1 module [[!CSS-GRID-1]] .
19+ The main addition to Level 1 is the “subgrid” feature,
20+ which has two proposals:
2021
21- * Subgrids
22- * Aspect-ratio-controlled gutters
23-
24- Issue: The full text of the Grid specification will be folded in for CR.
25-
26- <h2 id="grid-model">
27- Grid Containers</h2>
22+ <ul>
23+ <li>
24+ <a href="#subgrid-per-axis">Per-axis Subgrids</a> ,
25+ which use a ''grid-template-columns/subgrid'' keyword on the 'grid-template' properties
26+ to mark one or both axes as subgridded.
27+ This proposal is strictly more powerful.
28+ <li>
29+ <a href="#subgrid-dual-axis">Dual-axis Subgrids</a> ,
30+ whic use a ''grid-template-columns/subgrid'' keyword on the 'display' property
31+ to mark both axes as subgridded.
32+ This proposal is strictly more limited.
33+ </ul>
2834
29- <h3 id='grid-containers'>
30- Establishing Grid Containers: the ''subgrid'' 'display' value</h3>
35+ A subgridded axis is one which matches up its grid lines
36+ to lines in the element's parent's grid,
37+ and which derives the sizes of its tracks
38+ through this integration with the parent grid.
39+ In general, the behavior of subgrids are the same in both proposals:
40+ it is only a question of whether a single-axis subgrid is possible.
3141
32- <a>Subgrids</a> provide the ability to pass grid parameters down through nested elements,
33- and content-based sizing information back up to their parent grid.
34-
35- <pre class="propdef">
36- Name : display
37- New values : subgrid
38- </pre>
42+ Issue: The full text of the Grid specification will be folded in when this draft reaches CR.
3943
40- <dl dfn-for="display" dfn-type=value>
41- <dt> <dfn>subgrid</dfn>
42- <dd>
43- If the element is a <a>grid item</a>
44- (i.e. it is in-flow and its parent is a <a>grid container</a> ),
45- this value makes the element a <a>subgrid</a>
46- (which is a special type of <a>grid container</a> box, see [[#subgrids]] )
47- and consequently ignores its 'grid-template-*' and 'grid-*-gap' properties
48- in favor of adopting the parent grid tracks that it spans.
44+ <!--
45+ ██████ ██ ██ ████████ ██████ ████████ ████ ████████
46+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
47+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
48+ ██████ ██ ██ ████████ ██ ████ ████████ ██ ██ ██
49+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
50+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
51+ ██████ ███████ ████████ ██████ ██ ██ ████ ████████
52+ -->
4953
50- Otherwise,
51- it behaves as ''grid'' .
52- </dl>
54+ <h2 id="subgrid-per-axis">
55+ Subgrids: per-axis proposal</h2>
5356
5457<div class="issue">
5558 There is a proposal to have ''subgrid'' be instead a keyword
5659 for 'grid-template-rows' and 'grid-template-columns' ,
5760 which would allow subgridding to apply to a single axis,
5861 not only both axes simultaneously.
59- The same constraints apply as specified in <a href="# subgrids"></a> ,
62+ The same constraints apply as specified for dual-axis subgrids via 'display' ,
6063 but only to the subgridded dimension.
6164
6265 As with the ''display: subgrid'' proposal,
@@ -137,16 +140,6 @@ Establishing Grid Containers: the ''subgrid'' 'display' value</h3>
137140 </ol>
138141</div>
139142
140- <!--
141- ██████ ██ ██ ████████ ██████ ████████ ████ ████████
142- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
143- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
144- ██████ ██ ██ ████████ ██ ████ ████████ ██ ██ ██
145- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
146- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
147- ██████ ███████ ████████ ██████ ██ ██ ████ ████████
148- -->
149-
150143<h2 id="subgrids">
151144Subgrids</h2>
152145
@@ -155,8 +148,7 @@ Subgrids</h2>
155148
156149 In some cases it might be necessary for the contents of multiple <a>grid items</a> to align to each other.
157150 A <a>grid container</a> that is itself a <a>grid item</a>
158- can defer the definition of its rows and columns to its parent <a>grid container</a>
159- by using ''display: subgrid'' ,
151+ can defer the definition of its rows and columns to its parent <a>grid container</a> ,
160152 making it a <dfn export>subgrid</dfn> .
161153 In this case, the <a>grid items</a> of the <a>subgrid</a>
162154 participate in sizing the <a>grid</a> of the parent <a>grid container</a> ,
@@ -182,11 +174,11 @@ Subgrids</h2>
182174 grid: auto-flow / auto 1fr;
183175 }
184176 li {
185- display: subgrid;
186177 grid-column: span 2;
187- margin: 0.5em;
178+ <del> display: subgrid;</del>
179+ <ins> display: grid;
180+ grid: subgrid;</ins>
188181 border: solid;
189- padding: 0.5em;
190182 }
191183 label {
192184 grid-column: 1;
@@ -196,12 +188,66 @@ Subgrids</h2>
196188 }
197189 </pre>
198190 </div>
191+ <h3 id="subgrid-dual-axis">
192+ Establishing a Subgrid: Dual-axis Proposal</h3>
193+
194+ <a>Subgrids</a> provide the ability to pass grid parameters down through nested elements,
195+ and content-based sizing information back up to their parent grid.
196+
197+ <pre class="propdef">
198+ Name : display
199+ New values : subgrid
200+ </pre>
201+
202+ <dl dfn-for="display" dfn-type=value>
203+ <dt> <dfn>subgrid</dfn>
204+ <dd>
205+ If the element is a <a>grid item</a>
206+ (i.e. it is in-flow and its parent is a <a>grid container</a> ),
207+ this value makes the element a <a>subgrid</a>
208+ (which is a special type of <a>grid container</a> box, see [[#subgrids]] )
209+ and consequently ignores its 'grid-template-*' and '*-gap' properties
210+ in favor of adopting the parent grid tracks that it spans.
211+
212+ Otherwise,
213+ it behaves as ''grid'' .
214+ </dl>
215+
216+ Issue: This syntax only allows for subgrids which are subgridded in both axes.
217+
218+ <h3 id="subgrid-per-axis">
219+ Establishing a Subgrid: Per-Axis Proposal</h3>
220+
221+ <a>Subgrids</a> provide the ability to pass grid parameters down through nested elements,
222+ and content-based sizing information back up to their parent grid.
223+
224+ <pre class="propdef">
225+ Name : grid-template-rows, grid-template-columns
226+ New values : subgrid
227+ </pre>
228+
229+ <dl dfn-for="display" dfn-type=value>
230+ <dt> <dfn>subgrid</dfn>
231+ <dd>
232+ Tracks are <a>subgridded</a> in this axis:
233+ the tracks are adopted from the the parent grid tracks that it spans.
234+ If there is no parent grid, equivalent to
235+ the initial value, ''grid-template-rows/none'' .
236+ </dl>
237+
238+ Issue: This syntax allows for subgrids which are subgridded in one <em> or</em> both axes.
239+
240+ <h2 id="subgrid-rules">
241+ Subgrid Rules</h2>
242+
243+ Note: <ins> Insertions</ins> are differences between the dual-axis and per-axis proposals.
199244
200245 A <a>subgrid</a> behaves just like a normal <a>grid container</a> except that:
201246
202247 <ul style="list-style-type: lower-alpha">
203248 <li>
204- The number of explicit tracks is given by its <a>grid span</a> ,
249+ The number of explicit tracks in each <ins> subgridded</ins> dimension
250+ is given by its <a>grid span</a> in that dimension,
205251 rather than by 'grid-template-rows' /'grid-template-columns' .
206252
207253 <li>
@@ -210,11 +256,19 @@ Subgrids</h2>
210256 E.g., numeric indices count starting from the first line of the subgrid
211257 rather than the first line of the parent grid.
212258
259+ <li>
260+ Since <a>subgrids</a> can be placed before their contents are placed,
261+ <del> their</del> <ins> the subgridded</ins> lines
262+ automatically receive the line names specified on the parent <a>grid</a> .
263+
213264 <li>
214265 The <a>subgrid</a> itself lays out as an ordinary <a>grid item</a> in its parent grid,
215- but acts as if it was completely empty for sizing purposes.
266+ but acts as if it was completely empty for sizing purposes
267+ <ins> in the subgridded dimension</ins> .
216268
217- The <a>subgrid</a> 's own <a>grid items</a> participate in the sizing of its parent grid and are aligned to it.
269+ The <a>subgrid</a> 's own <a>grid items</a> participate
270+ in the sizing of its parent grid <ins> in the subgridded dimension(s)</ins>
271+ and are aligned to it <ins> in those dimensions</ins> .
218272 In this process, the sum of the <a>subgrid</a> 's margin, padding, and borders at each edge
219273 are applied as an extra layer of margin to the items at those edges.
220274
@@ -241,18 +295,20 @@ Subgrids</h2>
241295 <pre> #subgrid { padding: 100px; }</pre>
242296
243297 Then a <a>grid item</a> in the <a>subgrid's</a> first track
244- acts as if it has an additional ''100px'' of top, left, and bottom margin
298+ acts as if it has an additional ''100px'' of top, left, and bottom margin,
245299 influencing the sizing of the parent grid's tracks
246300 and the <a>grid item's</a> own position.
247301 </div>
248302
249303 <li>
250- The 'grid-gap' properties do not apply to subgrids.
251- (Their items are instead spaced by the 'grid-gap' of their parent grid,
304+ The 'gap' properties do not apply <del> to subgrids</del>
305+ <ins> in the subgridded dimension(s)</ins> .
306+ (Their items are instead spaced by the corresponding gutters of their parent grid,
252307 since they are laid out in the parent grid.)
253308
254309 <li>
255- The <a>subgrid</a> does not have any <a>implicit grid tracks</a> ;
310+ The <a>subgrid</a> does not have any <a>implicit grid tracks</a>
311+ <ins> in the subgridded dimension(s)</ins> ;
256312 every <a>grid area</a> within it is <a>clamped</a> to its <a>explicit grid</a> .
257313
258314 <div class="example">
@@ -261,24 +317,21 @@ Subgrids</h2>
261317 </div>
262318
263319 <li>
264- The <a>subgrid</a> is always stretched in both dimensions:
320+ The <a>subgrid</a> is always stretched <del> in both dimensions</del> <ins> in its subgridded dimension(s) </ins> :
265321 the 'align-self' /'justify-self' properties on it are ignored,
266322 as are any specified width/height constraints.
267323
268324 <li>
269- Layoutwise, the <a>subgrid</a> ’s <a>explicit grid</a>
325+ Layoutwise, the <a>subgrid</a> ’s <a>grid</a>
270326 is always aligned with the corresponding section of the parent <a>grid</a> ;
271- the 'align-content' /'justify-content' properties on it are also ignored.
327+ the 'align-content' /'justify-content' properties on it are also ignored
328+ <ins> in the subgridded dimension</ins> .
272329
273330 <li>
274331 The UA <em> may</em> apply 'overflow' to <a>subgrids</a>
275- so the contents of the subgrid can be scrolled aside .
332+ so that overflowing contents of the subgrid can be scrolled into view .
276333 (Note: the act of scrolling does not affect layout.)
277334 Overflow must otherwise be treated as ''visible'' .
278-
279- <li>
280- Since <a>subgrids</a> can be placed before their contents are placed,
281- their lines automatically receive the line names specified on the parent <a>grid</a> .
282335 </ul>
283336
284337<h2 id=alignment>
0 commit comments