Skip to content

Commit 60af883

Browse files
committed
[css-grid] Add row-gap/column-gap (gutters) per WG resolution <https://lists.w3.org/Archives/Public/www-style/2013Dec/0121.html>
1 parent 44d590b commit 60af883

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

css-grid/Overview.bs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2827,7 +2827,7 @@ With a Grid Container as Parent</h3>
28272827
-->
28282828

28292829
<h2 id='alignment'>
2830-
Alignment</h2>
2830+
Alignment and Spacing</h2>
28312831

28322832
After a <a>grid container</a>’s <a>grid tracks</a> have been sized,
28332833
and the dimensions of all <a>grid items</a> are finalized,
@@ -2845,6 +2845,43 @@ Alignment</h2>
28452845
or margins are <a value for="margin">auto</a>,
28462846
<a>grid items</a> will auto-size to fit their contents.
28472847

2848+
<h3 id='gutters'>
2849+
Gutters: the 'column-gap' and 'row-gap' properties</h3>
2850+
2851+
<pre class='propdef'>
2852+
Name: row-gap, column-gap
2853+
Value: normal | <<length>>
2854+
Initial: normal
2855+
Applies to: <a>grid containers</a>
2856+
Inherited: no
2857+
Percentages: n/a
2858+
Media: visual
2859+
Computed value: specified value
2860+
</pre>
2861+
2862+
These properties specify the <dfn lt=gutter>gutters</dfn> between
2863+
<a>grid rows</a> and <a>grid columns</a>, respectively.
2864+
The effect is as though the affected <a>grid lines</a> acquired width:
2865+
the <a>grid track</a> between two <a>grid lines</a>
2866+
is the space between the <i>gutters</i> that represent them.
2867+
For the purpose of <a href="#algo-track-sizing">track sizing</a>,
2868+
each <i>gutter</i> is essentially treated as an extra track of the specified length.
2869+
2870+
Note: Additional spacing may be added between tracks
2871+
due to 'justify-content'/'align-content'.
2872+
See [[#algo-overview]].
2873+
This space effectively increases the size of the <i>gutters</i>.
2874+
2875+
Issue: We'd like to have a shorthand for this. Naming suggestions? (“grid-gap” is my best proposal so far)
2876+
'border-spacing' was proposed before, but we can't use it because it inherits :(
2877+
2878+
Issue: Should the 'grid' shorthand reset these properties? (I think that'd be a good idea.)
2879+
2880+
On <a>grid containers</a>, a value of <dfn for="row-gap,column-gap" dfn-type=value>normal</dfn> computes to zero.
2881+
2882+
Issue: It would be nice if we didn't have ''row-gap/normal'', but it exists for multi-column elements.
2883+
So we have it here, set to zero. It computes to zero so that getComputedStyle is straightforward to work with.
2884+
We could theoretically make it compute (to ''1em'') on multi-columns, too.
28482885

28492886
<h3 id='auto-margins'>
28502887
Aligning with <a value for="margin">auto</a> margins</h3>

0 commit comments

Comments
 (0)