Skip to content

Commit ef68539

Browse files
committed
[css-grid-2] Add proposal for aspect-ratio--controlled gutters. w3c#1116
1 parent df09a08 commit ef68539

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

css-grid-2/Overview.bs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Introduction {#intro}
1616
=====================
1717

1818
This level is currently maintained as a diff spec over the level 1 module [[!CSS-GRID-1]].
19+
It adds the following features:
20+
21+
* Subgrids
22+
* Aspect-ratio-controlled gutters
23+
24+
Issue: There's currently also an issue about Masonry layout, but it's unlikely to make it for L2.
1925

2026
<h2 id="grid-model">
2127
Grid Containers</h2>
@@ -275,6 +281,88 @@ Subgrids</h2>
275281
their lines automatically receive the line names specified on the parent <a>grid</a>.
276282
</ul>
277283

284+
<h2 id=alignment>
285+
Aspect-ratio&ndash;controlled Gutters</h2>
286+
287+
Issue: There's a desire for having row and column gaps maintain a particular aspect ratio.
288+
This is one proposal for doing so; other ideas are welcome.<br>
289+
Possible extension: allow aspect ratio multipliers on 'row-gap' and 'column-gap' as well (not really useful except if you're using percents).<br>
290+
Possible variation: use an `ar` unit instead of bare <<number>>s.
291+
292+
<pre class="propdef">
293+
Name: align-content, justify-content
294+
New values: [ <<number>> && <<content-distribution>>? ]
295+
</pre>
296+
297+
<dl dfn-for="align-content,justify-content" dfn-type=value>
298+
<dt><dfn><<number>></dfn>
299+
<dd>
300+
Represents a multiplier against the analogous quantity
301+
in the other dimension.
302+
If that quantity cannot be determined
303+
(e.g. is itself specified as a <<number>>, or otherwise can't be referenced),
304+
then it is assumed to be zero.
305+
306+
Note: This value can expand gutters
307+
even when there is no free space left,
308+
causing oveflow.
309+
310+
Specifically, an 'align-content' value of ''1'' represents
311+
the amount of space (which may be zero) allocated between two adjacent
312+
<a>alignment subjects</a> (<a>grid tracks</a> / <a>flex lines</a> / <a>column boxes</a>)
313+
by the 'justify-content' property.
314+
Unless a different <<content-distribution>> value is specified,
315+
space is distributed according to the same <<content-distribution>> rules
316+
as for 'justify-content'.
317+
The behavior of <<number>> values for 'justify-content' is analogous.
318+
319+
Note: The space allocated by ''align-content: 1'' will be zero
320+
if 'justify-content' does not allocate space
321+
between adjacent <a>alignment subjects</a>:
322+
either due to not having a <<content-distribution>> value
323+
or due to there being fewer than two <a>alignment subjects</a>.
324+
325+
If both 'align-content' and 'justify-content' have <<number>> values,
326+
then 'justify-content'’s <<number>> value is ignored
327+
and its <<content-distribution>> value honored as if specified alone.
328+
If no <<content-distribution>> value was specified,
329+
then 'justify-content' takes 'align-content'’s <<content-distribution>> value
330+
(if one was specified)
331+
and otherwise falls back to ''space-between''.
332+
</dl>
333+
334+
<div class="example">
335+
In this example,
336+
a minimum of 1em is required between rows and columns.
337+
Additionally, any extra space in the inline axis
338+
that is distributed between columns,
339+
with full-size spaces on either side of the outermost columns.
340+
The gaps between rows are increased to match the extra space
341+
distributed between adjacent columns,
342+
but no space is added before the first row or after the last one.
343+
344+
<pre>
345+
.grid {
346+
grid-template-columns: repeat(auto-fill, 15em);
347+
gap: 1em;
348+
justify-content: space-evenly;
349+
align-content: 1.0 space-between;
350+
}
351+
</pre>
352+
353+
This next example is the same as the previous,
354+
except that the ratio between row and column gaps is &phi;:
355+
356+
<pre>
357+
.grid {
358+
grid-template-columns: repeat(auto-fill, 15em);
359+
gap: 1em 1.618em;
360+
justify-content: space-evenly;
361+
align-content: 0.618 space-between;
362+
}
363+
</pre>
364+
</div>
365+
278366
<!--
279367
██ ██ ███ ██████ ███████ ██ ██ ████████ ██ ██
280368
███ ███ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██

0 commit comments

Comments
 (0)