@@ -453,30 +453,30 @@ Grid Lines</h3>
453
453
454
454
<pre>
455
455
<style type="text/css">
456
- #grid {
456
+ #grid {
457
457
display: grid;
458
458
grid-template-columns: 150px 1fr;
459
459
grid-template-rows: 50px 1fr 50px
460
- }
460
+ }
461
461
462
- #item1 { grid-column: 2;
463
- grid-row-start: 1; grid-row-end: 4; }
462
+ #item1 { grid-column: 2;
463
+ grid-row-start: 1; grid-row-end: 4; }
464
464
</style>
465
465
</pre>
466
466
467
467
<pre>
468
468
<style type="text/css">
469
- /* equivalent layout to the prior example, but using named lines */
470
- #grid {
469
+ /* equivalent layout to the prior example, but using named lines */
470
+ #grid {
471
471
display: grid;
472
472
grid-template-columns: 150px (item1-start) 1fr (item1-end);
473
473
grid-template-rows: (item1-start) 50px 1fr 50px (item1-end);
474
- }
474
+ }
475
475
476
- #item1 {
476
+ #item1 {
477
477
grid-column: item1-start / item1-end;
478
478
grid-row: item1-start / item1-end
479
- }
479
+ }
480
480
</style>
481
481
</pre>
482
482
</div>
@@ -496,25 +496,25 @@ Grid Areas</h3>
496
496
<div class="example">
497
497
<pre>
498
498
<style type="text/css">
499
- /* using the template syntax */
500
- #grid {
501
- display: grid;
502
- grid-template-areas: ". a"
503
- "b a"
504
- ". a";
505
- grid-template-columns: 150px 1fr;
506
- grid-template-rows: 50px 1fr 50px
507
- }
508
-
509
- #item1 { grid-area: a }
510
- #item2 { grid-area: b }
511
- #item3 { grid-area: b }
512
-
513
- /* Align items 2 and 3 at different points in the Grid Area "b". */
514
- /* By default, Grid Items are stretched to fit their Grid Area */
515
- /* and these items would layer one over the other. */
516
- #item2 { align-self: start }
517
- #item3 { justify-self: end; align-self: end }
499
+ /* using the template syntax */
500
+ #grid {
501
+ display: grid;
502
+ grid-template-areas: ". a"
503
+ "b a"
504
+ ". a";
505
+ grid-template-columns: 150px 1fr;
506
+ grid-template-rows: 50px 1fr 50px
507
+ }
508
+
509
+ #item1 { grid-area: a }
510
+ #item2 { grid-area: b }
511
+ #item3 { grid-area: b }
512
+
513
+ /* Align items 2 and 3 at different points in the Grid Area "b". */
514
+ /* By default, Grid Items are stretched to fit their Grid Area */
515
+ /* and these items would layer one over the other. */
516
+ #item2 { align-self: start }
517
+ #item3 { justify-self: end; align-self: end }
518
518
</style>
519
519
</pre>
520
520
</div>
@@ -780,25 +780,25 @@ Z-axis Ordering: the 'z-index' property</h3>
780
780
781
781
<pre>
782
782
<style type="text/css">
783
- #grid {
783
+ #grid {
784
784
display: grid;
785
785
grid-template-columns: 1fr 1fr;
786
786
grid-template-rows: 1fr 1fr
787
- }
788
- #A { grid-column: 1 / span 2; grid-row: 2; align-self: end; }
789
- #B { grid-column: 1; grid-row: 1; z-index: 10; }
790
- #C { grid-column: 2; grid-row: 1; align-self: start; margin-left: -20px; }
791
- #D { grid-column: 2; grid-row: 2; justify-self: end; align-self: start; }
792
- #E { grid-column: 1 / span 2; grid-row: 1 / span 2;
793
- z-index: 5; justify-self: center; align-self: center; }
787
+ }
788
+ #A { grid-column: 1 / span 2; grid-row: 2; align-self: end; }
789
+ #B { grid-column: 1; grid-row: 1; z-index: 10; }
790
+ #C { grid-column: 2; grid-row: 1; align-self: start; margin-left: -20px; }
791
+ #D { grid-column: 2; grid-row: 2; justify-self: end; align-self: start; }
792
+ #E { grid-column: 1 / span 2; grid-row: 1 / span 2;
793
+ z-index: 5; justify-self: center; align-self: center; }
794
794
</style>
795
795
796
796
<div id="grid">
797
- <div id="A">A</div>
798
- <div id="B">B</div>
799
- <div id="C">C</div>
800
- <div id="D">D</div>
801
- <div id="E">E</div>
797
+ <div id="A">A</div>
798
+ <div id="B">B</div>
799
+ <div id="C">C</div>
800
+ <div id="D">D</div>
801
+ <div id="E">E</div>
802
802
</div>
803
803
</pre>
804
804
</div>
@@ -1009,11 +1009,11 @@ Named Grid Lines: the <css>(<<custom-ident>>*)</css> syntax</h4>
1009
1009
1010
1010
<pre>
1011
1011
<style>
1012
- #grid {
1012
+ #grid {
1013
1013
display: grid;
1014
1014
grid-template-columns: (first nav) 150px (main) 1fr (last);
1015
1015
grid-template-rows: (first header) 50px (main) 1fr (footer) 50px (last);
1016
- }
1016
+ }
1017
1017
</style>
1018
1018
</pre>
1019
1019
@@ -1067,21 +1067,21 @@ Repeating Rows and Columns: the ''repeat()'' notation</h4>
1067
1067
1068
1068
<pre>
1069
1069
<style>
1070
- #grid {
1070
+ #grid {
1071
1071
display: grid;
1072
1072
grid-template-columns: 10px (col-start) 250px (col-end)
1073
- 10px (col-start) 250px (col-end)
1074
- 10px (col-start) 250px (col-end)
1075
- 10px (col-start) 250px (col-end) 10px;
1073
+ 10px (col-start) 250px (col-end)
1074
+ 10px (col-start) 250px (col-end)
1075
+ 10px (col-start) 250px (col-end) 10px;
1076
1076
grid-template-rows: 1fr;
1077
- }
1077
+ }
1078
1078
1079
- /* Equivalent definition. */
1080
- #grid {
1079
+ /* Equivalent definition. */
1080
+ #grid {
1081
1081
display: grid;
1082
1082
grid-template-columns: repeat(4, 10px (col-start) 250px (col-end)) 10px;
1083
1083
grid-template-rows: 1fr;
1084
- }
1084
+ }
1085
1085
</style>
1086
1086
</pre>
1087
1087
</div>
@@ -1326,14 +1326,14 @@ Resolved Values</h4>
1326
1326
<div class="example">
1327
1327
<pre>
1328
1328
<style>
1329
- #grid {
1329
+ #grid {
1330
1330
width: 500px;
1331
1331
grid-template-columns:
1332
1332
(a) auto
1333
1333
(b) minmax(min-content, 1fr)
1334
1334
(b c d) repeat(2, (e) 40px)
1335
- repeat(5, auto);
1336
- }
1335
+ repeat(5, auto);
1336
+ }
1337
1337
</style>
1338
1338
<div id="grid">
1339
1339
<div style="grid-column-start:1; width:50px"></div>
@@ -1462,16 +1462,16 @@ Named Areas: the 'grid-template-areas' property</h3>
1462
1462
1463
1463
<pre>
1464
1464
<style type="text/css">
1465
- #grid {
1465
+ #grid {
1466
1466
display: grid;
1467
1467
grid-template-areas: "head head"
1468
- "nav main"
1469
- "foot . "
1470
- }
1471
- #grid > header { grid-area: head; }
1472
- #grid > nav { grid-area: nav; }
1473
- #grid > main { grid-area: main; }
1474
- #grid > footer { grid-area: foot; }
1468
+ "nav main"
1469
+ "foot . "
1470
+ }
1471
+ #grid > header { grid-area: head; }
1472
+ #grid > nav { grid-area: nav; }
1473
+ #grid > main { grid-area: main; }
1474
+ #grid > footer { grid-area: foot; }
1475
1475
</style>
1476
1476
</pre>
1477
1477
</div>
@@ -1765,78 +1765,78 @@ Sizing Auto-generated Rows and Columns: the 'grid-auto-rows' and 'grid-auto-colu
1765
1765
1766
1766
<pre>
1767
1767
<style type="text/css">
1768
- form {
1768
+ form {
1769
1769
display: grid;
1770
1770
/* Define three columns, all content-sized,
1771
1771
and name the corresponding lines. */
1772
1772
grid-template-columns: (labels) auto (controls) auto (oversized) auto;
1773
1773
grid-auto-flow: row;
1774
- }
1775
- form > label {
1774
+ }
1775
+ form > label {
1776
1776
/* Place all labels in the "labels" column and
1777
1777
automatically find the next available row. */
1778
1778
grid-column: labels;
1779
1779
grid-row: auto;
1780
- }
1781
- form > input, form > select {
1780
+ }
1781
+ form > input, form > select {
1782
1782
/* Place all controls in the "controls" column and
1783
1783
automatically find the next available row. */
1784
1784
grid-column: controls;
1785
1785
grid-row: auto;
1786
- }
1786
+ }
1787
1787
1788
- #department {
1788
+ #department {
1789
1789
/* Auto place this item in the "oversized" column
1790
1790
in the first row where an area that spans three rows
1791
1791
won't overlap other explicitly placed items or areas
1792
1792
or any items automatically placed prior to this area. */
1793
1793
grid-column: oversized;
1794
1794
grid-row: span 3;
1795
- }
1795
+ }
1796
1796
1797
- /* Place all the buttons of the form
1798
- in the explicitly defined grid area. */
1799
- #buttons {
1797
+ /* Place all the buttons of the form
1798
+ in the explicitly defined grid area. */
1799
+ #buttons {
1800
1800
grid-row: auto;
1801
1801
1802
1802
/* Ensure the button area spans the entire grid element
1803
1803
in the row axis. */
1804
1804
grid-column: 1 / -1;
1805
1805
text-align: end;
1806
- }
1806
+ }
1807
1807
</style>
1808
1808
<form>
1809
- <label for="firstname">First name:</label>
1810
- <input type="text" id="firstname" name="firstname" />
1811
- <label for="lastname">Last name:</label>
1812
- <input type="text" id="lastname" name="lastname" />
1813
- <label for="address">Address:</label>
1814
- <input type="text" id="address" name="address" />
1815
- <label for="address2">Address 2:</label>
1816
- <input type="text" id="address2" name="address2" />
1817
- <label for="city">City:</label>
1818
- <input type="text" id="city" name="city" />
1819
- <label for="state">State:</label>
1820
- <select type="text" id="state" name="state">
1821
- <option value="WA">Washington</option>
1822
- </select>
1823
- <label for="zip">Zip:</label>
1824
- <input type="text" id="zip" name="zip" />
1825
-
1826
- <div id="department">
1827
- <label for="department">Department:</label>
1828
- <select id="department" name="department" multiple>
1829
- <option value="finance">Finance</option>
1830
- <option value="humanresources">Human Resources</option>
1831
- <option value="marketing">Marketing</option>
1809
+ <label for="firstname">First name:</label>
1810
+ <input type="text" id="firstname" name="firstname" />
1811
+ <label for="lastname">Last name:</label>
1812
+ <input type="text" id="lastname" name="lastname" />
1813
+ <label for="address">Address:</label>
1814
+ <input type="text" id="address" name="address" />
1815
+ <label for="address2">Address 2:</label>
1816
+ <input type="text" id="address2" name="address2" />
1817
+ <label for="city">City:</label>
1818
+ <input type="text" id="city" name="city" />
1819
+ <label for="state">State:</label>
1820
+ <select type="text" id="state" name="state">
1821
+ <option value="WA">Washington</option>
1832
1822
</select>
1833
- </div>
1834
-
1835
- <div id="buttons">
1836
- <button id="cancel">Cancel</button>
1837
- <button id="back">Back</button>
1838
- <button id="next">Next</button>
1839
- </div>
1823
+ <label for="zip">Zip:</label>
1824
+ <input type="text" id="zip" name="zip" />
1825
+
1826
+ <div id="department">
1827
+ <label for="department">Department:</label>
1828
+ <select id="department" name="department" multiple>
1829
+ <option value="finance">Finance</option>
1830
+ <option value="humanresources">Human Resources</option>
1831
+ <option value="marketing">Marketing</option>
1832
+ </select>
1833
+ </div>
1834
+
1835
+ <div id="buttons">
1836
+ <button id="cancel">Cancel</button>
1837
+ <button id="back">Back</button>
1838
+ <button id="next">Next</button>
1839
+ </div>
1840
1840
</form>
1841
1841
</pre>
1842
1842
</div>
0 commit comments