Skip to content

Commit e8736c3

Browse files
committed
[css-grid] Change named line syntax to use parents+idents rather than strings.
1 parent 286a2bd commit e8736c3

2 files changed

Lines changed: 83 additions & 82 deletions

File tree

css-grid/Overview.html

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -648,13 +648,13 @@ <h3 id=grid-layering><span class=secno>1.4. </span> Grid Layering of
648648
* items. The line names are assigned on either side of a column
649649
* or row sizing function where the line would logically exist. */
650650
grid-template-columns:
651-
"start" auto
652-
"track-start" 0.5fr
653-
"thumb-start" auto
654-
"fill-split" auto
655-
"thumb-end" 0.5fr
656-
"track-end" auto
657-
"end";
651+
(start) auto
652+
(track-start) 0.5fr
653+
(thumb-start) auto
654+
(fill-split) auto
655+
(thumb-end) 0.5fr
656+
(track-end) auto
657+
(end);
658658
}
659659

660660
/* The grid-placement properties accept named lines. Below the
@@ -666,20 +666,20 @@ <h3 id=grid-layering><span class=secno>1.4. </span> Grid Layering of
666666
* changes, but grid lines can also work with layered grid items
667667
* that have overlapping areas of different shapes like the thumb
668668
* and track parts in this example. */
669-
#lower-label { grid-column-start: "start" }
670-
#track { grid-column: "track-start" / "track-end"; align-self: center }
671-
#upper-label { grid-column-end: "end"; }
669+
#lower-label { grid-column-start: start }
670+
#track { grid-column: track-start / track-end; align-self: center }
671+
#upper-label { grid-column-end: end; }
672672

673673
/* Fill parts are drawn above the track so set z-index to 5. */
674-
#lower-fill { grid-column: "track-start" / "fill-split";
674+
#lower-fill { grid-column: track-start / fill-split;
675675
align-self: end;
676676
z-index: 5 }
677-
#upper-fill { grid-column: "fill-split" / "track-end";
677+
#upper-fill { grid-column: fill-split / track-end;
678678
align-self: start;
679679
z-index: 5 }
680680

681681
/* Thumb is the topmost part; assign it the highest z-index value. */
682-
#thumb { grid-column: "thumb-start" / "thumb-end"; z-index: 10 }
682+
#thumb { grid-column: thumb-start / thumb-end; z-index: 10 }
683683
&lt;/style>
684684

685685
&lt;div id="grid">
@@ -794,13 +794,13 @@ <h3 id=grid-line-concept><span class=secno>2.2. </span> Grid Lines</h3>
794794
/* equivalent layout to the prior example, but using named lines */
795795
#grid {
796796
display: grid;
797-
grid-template-columns: 150px "item1-start" 1fr "item1-end";
798-
grid-template-rows: "item1-start" 50px 1fr 50px "item1-end"
797+
grid-template-columns: 150px (item1-start) 1fr (item1-end);
798+
grid-template-rows: (item1-start) 50px 1fr 50px (item1-end);
799799
}
800800

801801
#item1 {
802-
grid-column: "item1-start" / "item1-end";
803-
grid-row: "item1-start" / "item1-end"
802+
grid-column: item1-start / item1-end;
803+
grid-row: item1-start / item1-end
804804
}
805805
&lt;/style></pre>
806806
</div>
@@ -1311,18 +1311,23 @@ <h3 id=track-sizing><span class=secno>5.1. </span> Track Sizing: the ‘<a
13111311
of a <a href="#track-list"><i>track list</i></a> is:
13121312

13131313
<pre>
1314-
<dfn
1315-
id=lttrack-list>&lt;track-list></dfn> = [ <var>&lt;string></var>* [ <a
1314+
<dfn id=lttrack-list>&lt;track-list></dfn> = [ <a
1315+
href="#ltline-names"><var>&lt;line-names></var></a>? [ <a
13161316
href="#lttrack-size"><var>&lt;track-size></var></a> | <a
1317-
href="#ltrepeat-function"><var>&lt;repeat-function></var></a> ] ]+ <var>&lt;string></var>*
1317+
href="#ltrepeat-function"><var>&lt;repeat-function></var></a> ] ]+ <a
1318+
href="#ltline-names"><var>&lt;line-names></var></a>?
13181319
<dfn
13191320
id=lttrack-size>&lt;track-size></dfn> = minmax( <a
13201321
href="#lttrack-breadth"><var>&lt;track-breadth></var></a> , <a
13211322
href="#lttrack-breadth"><var>&lt;track-breadth></var></a> ) | auto | <a
13221323
href="#lttrack-breadth"><var>&lt;track-breadth></var></a>
13231324
<dfn
13241325
id=lttrack-breadth>&lt;track-breadth></dfn> = <var>&lt;length></var> | <var>&lt;percentage></var> | <a
1325-
href="#ltflex"><var>&lt;flex></var></a> | min-content | max-content</pre>
1326+
href="#ltflex"><var>&lt;flex></var></a> | min-content | max-content
1327+
<dfn
1328+
id=ltline-names>&lt;line-names></dfn> = ( <var>&lt;ident></var>+ )
1329+
1330+
</pre>
13261331

13271332
<p>Where:
13281333

@@ -1457,10 +1462,6 @@ <h3 id=track-sizing><span class=secno>5.1. </span> Track Sizing: the ‘<a
14571462

14581463
<h4 id=named-lines><span class=secno>5.1.1. </span> Named Grid Lines</h4>
14591464

1460-
<p class=issue> The syntax for named lines kindof sucks right now. See <a
1461-
href="http://lists.w3.org/Archives/Public/www-style/2013Mar/0266.html">thread
1462-
on www-style</a> and add your opinions!
1463-
14641465
<p> While <a href="#grid-line"><i>grid lines</i></a> can always be referred
14651466
to by their numerical index, they can also be explicitly named in the
14661467
<a href="#grid-template-rows"><code
@@ -1479,8 +1480,8 @@ <h4 id=named-lines><span class=secno>5.1.1. </span> Named Grid Lines</h4>
14791480
<pre>&lt;style>
14801481
#grid {
14811482
display: grid;
1482-
grid-template-columns: "first" "nav" 150px "main" 1fr "last";
1483-
grid-template-rows: "first" "header" 50px "main" 1fr "footer" 50px "last";
1483+
grid-template-columns: (first nav) 150px (main) 1fr (last);
1484+
grid-template-rows: (first header) 50px (main) 1fr (footer) 50px (last);
14841485
}
14851486
&lt;/style></pre>
14861487

@@ -1523,17 +1524,17 @@ <h4 id=repeat-notation><span class=secno>5.1.2. </span> Repeating Rows and
15231524
&lt;style>
15241525
#grid {
15251526
display: grid;
1526-
grid-template-columns: 10px "col-start" 250px "col-end"
1527-
10px "col-start" 250px "col-end"
1528-
10px "col-start" 250px "col-end"
1529-
10px "col-start" 250px "col-end" 10px;
1527+
grid-template-columns: 10px (col-start) 250px (col-end)
1528+
10px (col-start) 250px (col-end)
1529+
10px (col-start) 250px (col-end)
1530+
10px (col-start) 250px (col-end) 10px;
15301531
grid-template-rows: 1fr;
15311532
}
15321533

15331534
/* Equivalent definition. */
15341535
#grid {
15351536
display: grid;
1536-
grid-template-columns: repeat(4, 10px "col-start" 250px "col-end") 10px;
1537+
grid-template-columns: repeat(4, 10px (col-start) 250px (col-end)) 10px;
15371538
grid-template-rows: 1fr;
15381539
}
15391540
&lt;/style></pre>
@@ -1606,10 +1607,10 @@ <h4 id=resolved-track-list><span class=secno>5.1.4. </span> Resolved Values</h4>
16061607
#grid {
16071608
width: 500px;
16081609
grid-template-columns:
1609-
"a" auto
1610-
"b" minmax(min-content, 1fr)
1611-
"b" "c" "d" repeat(2, "e" 40px)
1612-
repeat(5, auto);
1610+
(a) auto
1611+
(b) minmax(min-content, 1fr)
1612+
(b c d) repeat(2, (e) 40px)
1613+
repeat(5, auto);
16131614
}
16141615
&lt;/style>
16151616
&lt;div id="grid">
@@ -1619,7 +1620,7 @@ <h4 id=resolved-track-list><span class=secno>5.1.4. </span> Resolved Values</h4>
16191620
&lt;script>
16201621
var gridElement = document.getElementById("grid");
16211622
getComputedStyle(gridElement).gridDefinitionColumns;
1622-
// "a" 50px "b" 320px "b" "c" "d" repeat(2, "e" 40px) repeat(4, 0px) 50px
1623+
// (a) 50px (b) 320px (b c d) repeat(2, (e) 40px) repeat(4, 0px) 50px
16231624
&lt;/script></pre>
16241625
</div>
16251626

@@ -2314,19 +2315,19 @@ <h3 id=grid-auto-flow-property><span class=secno>6.3. </span> Automatic
23142315
display: grid;
23152316
/* Define three columns, all content-sized,
23162317
and name the corresponding lines. */
2317-
grid-template-columns: "labels" auto "controls" auto "oversized" auto;
2318+
grid-template-columns: (labels) auto (controls) auto (oversized) auto;
23182319
grid-auto-flow: rows;
23192320
}
23202321
form > label {
23212322
/* Place all labels in the "labels" column and
23222323
automatically find the next available row. */
2323-
grid-column: "labels";
2324+
grid-column: labels;
23242325
grid-row: auto;
23252326
}
23262327
form > input, form > select {
23272328
/* Place all controls in the "controls" column and
23282329
automatically find the next available row. */
2329-
grid-column: "controls";
2330+
grid-column: controls;
23302331
grid-row: auto;
23312332
}
23322333

@@ -2335,7 +2336,7 @@ <h3 id=grid-auto-flow-property><span class=secno>6.3. </span> Automatic
23352336
in the first row where an area that spans three rows
23362337
won't overlap other explicitly placed items or areas
23372338
or any items automatically placed prior to this area. */
2338-
grid-column: "oversized";
2339+
grid-column: oversized;
23392340
grid-row: span 3;
23402341
}
23412342

@@ -2346,7 +2347,7 @@ <h3 id=grid-auto-flow-property><span class=secno>6.3. </span> Automatic
23462347

23472348
/* Ensure the button area spans the entire grid element
23482349
in the row axis. */
2349-
grid-column: 1 / 1;
2350+
grid-column: 1 / -1;
23502351
text-align: end;
23512352
}
23522353
&lt;/style>
@@ -3885,6 +3886,9 @@ <h2 class=no-num id=index> Index</h2>
38853886
href="#function-ResolveContentBasedTrackSizingFunctionsForItems-inputs"
38863887
title="section 8.2."><strong>8.2.</strong></a>
38873888

3889+
<li>&lt;line-names>, <a href="#ltline-names"
3890+
title="section 5.1."><strong>5.1.</strong></a>
3891+
38883892
<li>max-content, <a href="#max-content"
38893893
title="section 5.1."><strong>5.1.</strong></a>
38903894

0 commit comments

Comments
 (0)