Skip to content

Commit 682fbaa

Browse files
committed
[css-grid] Imply named lines from grid area names.
1 parent ca51ea3 commit 682fbaa

File tree

2 files changed

+64
-11
lines changed

2 files changed

+64
-11
lines changed

css-grid/Overview.html

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
275275
<li><a href="#grid-template-areas-property"><span class=secno>5.2.
276276
</span> Named Areas: the ‘<code
277277
class=property>grid-template-areas</code>’ property</a>
278+
<ul class=toc>
279+
<li><a href="#implicit-named-lines"><span class=secno>5.2.1. </span>
280+
Implicit Named Lines</a>
281+
</ul>
278282

279283
<li><a href="#grid-template-property"><span class=secno>5.3. </span> The
280284
<code class=property>grid-template</code>’ shorthand property</a>
@@ -1456,11 +1460,16 @@ <h4 id=named-lines><span class=secno>5.1.1. </span> Named Grid Lines</h4>
14561460
<a href="#grid-template-rows"><code
14571461
class=property>grid-template-rows</code></a>’ and ‘<a
14581462
href="#grid-template-columns"><code
1459-
class=property>grid-template-columns</code></a>’ properties. This can
1463+
class=property>grid-template-columns</code></a>’ properties, or <a
1464+
href="#implicit-named-lines">implicitly named</a> by creating <a
1465+
href="#named-grid-areas"><i>named grid areas</i></a> with the ‘<a
1466+
href="#grid-template-areas"><code
1467+
class=property>grid-template-areas</code></a>’ property. Named lines can
14601468
make the <a href="#grid-placement-properties"><i>grid-placement
1461-
properties</i></a> easier to understand by using meaningful names in their
1462-
values, and easier to maintain if the grid definition changes in the
1463-
future.
1469+
properties</i></a> easier to understand by allowing meaningful names in
1470+
their values, and easier to maintain if the grid definition changes in the
1471+
future by tying a grid item’s position to a stable name rather than a
1472+
shifting numerical index.
14641473

14651474
<div class=example>
14661475
<p> For example, the following code gives meaningful names to all of the
@@ -1738,6 +1747,31 @@ <h3 id=grid-template-areas-property><span class=secno>5.2. </span> Named
17381747
&lt;/style></pre>
17391748
</div>
17401749

1750+
<h4 id=implicit-named-lines><span class=secno>5.2.1. </span> Implicit Named
1751+
Lines</h4>
1752+
1753+
<p> The ‘<a href="#grid-template-areas"><code
1754+
class=property>grid-template-areas</code></a>’ property creates <dfn
1755+
id=implicit-named-lines0 title="implicit named line">implicit named
1756+
lines</dfn> from the <a href="#named-grid-areas"><i>named grid
1757+
areas</i></a> in the template. For each <a
1758+
href="#named-grid-areas"><i>named grid area</i></a> <var>foo</var>, four
1759+
<a href="#implicit-named-lines0"><i>implicit named lines</i></a> are
1760+
created: two named ‘<code class=css><var>foo</var>-start</code>’,
1761+
naming the row-start and column-start lines of the <a
1762+
href="#named-grid-areas"><i>named grid area</i></a>, and two named
1763+
<code class=css><var>foo</var>-end</code>’, naming the row-end and
1764+
column-end lines of the <a href="#named-grid-areas"><i>named grid
1765+
area</i></a>.
1766+
1767+
<p> These named lines behave just like any other named line, except that
1768+
they do not appear in the value of ‘<a href="#grid-template-rows"><code
1769+
class=property>grid-template-rows</code></a>’/‘<a
1770+
href="#grid-template-columns"><code
1771+
class=property>grid-template-columns</code></a>’. Even if an explicit
1772+
line of the same name is defined, the implicit named lines are just more
1773+
lines with the same name.
1774+
17411775
<h3 id=grid-template-property><span class=secno>5.3. </span> The ‘<a
17421776
href="#grid-template"><code class=property>grid-template</code></a>
17431777
shorthand property</h3>
@@ -3818,10 +3852,10 @@ <h3 class=no-num id=normative-references> Normative references</h3>
38183852
<dt id=CSS3VAL>[CSS3VAL]
38193853

38203854
<dd>Håkon Wium Lie; Tab Atkins; Elika J. Etemad. <a
3821-
href="http://www.w3.org/TR/2013/CR-css3-values-20130404/"><cite>CSS
3822-
Values and Units Module Level 3.</cite></a> 4 April 2013. W3C Candidate
3855+
href="http://www.w3.org/TR/2013/CR-css3-values-20130730/"><cite>CSS
3856+
Values and Units Module Level 3.</cite></a> 30 July 2013. W3C Candidate
38233857
Recommendation. (Work in progress.) URL: <a
3824-
href="http://www.w3.org/TR/2013/CR-css3-values-20130404/">http://www.w3.org/TR/2013/CR-css3-values-20130404/</a>
3858+
href="http://www.w3.org/TR/2013/CR-css3-values-20130730/">http://www.w3.org/TR/2013/CR-css3-values-20130730/</a>
38253859
</dd>
38263860
<!---->
38273861

@@ -4018,6 +4052,9 @@ <h2 class=no-num id=index> Index</h2>
40184052
<li>implicit grid track, <a href="#implicit-grid-tracks"
40194053
title="section 5.4."><strong>5.4.</strong></a>
40204054

4055+
<li>implicit named line, <a href="#implicit-named-lines0"
4056+
title="section 5.2.1."><strong>5.2.1.</strong></a>
4057+
40214058
<li><code class=css>inline-grid</code>’, <a
40224059
href="#display-inline-grid"
40234060
title="section 3.1."><strong>3.1.</strong></a>

css-grid/Overview.src.html

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,10 +1056,12 @@ <h4 id='named-lines'>
10561056

10571057
<p>
10581058
While <i>grid lines</i> can always be referred to by their numerical index,
1059-
they can also be explicitly named in the 'grid-template-rows' and 'grid-template-columns' properties.
1060-
This can make the <i>grid-placement properties</i> easier to understand
1061-
by using meaningful names in their values,
1062-
and easier to maintain if the grid definition changes in the future.
1059+
they can also be explicitly named in the 'grid-template-rows' and 'grid-template-columns' properties,
1060+
or <a href="#implicit-named-lines">implicitly named</a> by creating <i>named grid areas</i> with the 'grid-template-areas' property.
1061+
Named lines can make the <i>grid-placement properties</i> easier to understand
1062+
by allowing meaningful names in their values,
1063+
and easier to maintain if the grid definition changes in the future
1064+
by tying a grid item’s position to a stable name rather than a shifting numerical index.
10631065

10641066
<div class='example'>
10651067
<p>
@@ -1321,6 +1323,20 @@ <h3 id="grid-template-areas-property">
13211323
&lt;/style></pre>
13221324
</div>
13231325

1326+
<h4 id="implicit-named-lines">
1327+
Implicit Named Lines</h4>
1328+
1329+
<p>
1330+
The 'grid-template-areas' property creates <dfn title="implicit named line">implicit named lines</dfn> from the <i>named grid areas</i> in the template.
1331+
For each <i>named grid area</i> <var>foo</var>, four <i>implicit named lines</i> are created:
1332+
two named ''<var>foo</var>-start'', naming the row-start and column-start lines of the <i>named grid area</i>,
1333+
and two named ''<var>foo</var>-end'', naming the row-end and column-end lines of the <i>named grid area</i>.
1334+
1335+
<p>
1336+
These named lines behave just like any other named line,
1337+
except that they do not appear in the value of 'grid-template-rows'/'grid-template-columns'.
1338+
Even if an explicit line of the same name is defined,
1339+
the implicit named lines are just more lines with the same name.
13241340

13251341
<h3 id='grid-template-property'>
13261342
The 'grid-template' shorthand property</h3>

0 commit comments

Comments
 (0)