@@ -453,30 +453,30 @@ Grid Lines</h3>
453453
454454 <pre>
455455 <style type="text/css">
456- #grid {
456+ #grid {
457457 display: grid;
458458 grid-template-columns: 150px 1fr;
459459 grid-template-rows: 50px 1fr 50px
460- }
460+ }
461461
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; }
464464 </style>
465465 </pre>
466466
467467 <pre>
468468 <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 {
471471 display: grid;
472472 grid-template-columns: 150px (item1-start) 1fr (item1-end);
473473 grid-template-rows: (item1-start) 50px 1fr 50px (item1-end);
474- }
474+ }
475475
476- #item1 {
476+ #item1 {
477477 grid-column: item1-start / item1-end;
478478 grid-row: item1-start / item1-end
479- }
479+ }
480480 </style>
481481 </pre>
482482 </div>
@@ -496,25 +496,25 @@ Grid Areas</h3>
496496 <div class="example">
497497 <pre>
498498 <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 }
518518 </style>
519519 </pre>
520520 </div>
@@ -780,25 +780,25 @@ Z-axis Ordering: the 'z-index' property</h3>
780780
781781 <pre>
782782 <style type="text/css">
783- #grid {
783+ #grid {
784784 display: grid;
785785 grid-template-columns: 1fr 1fr;
786786 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; }
794794 </style>
795795
796796 <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>
802802 </div>
803803 </pre>
804804 </div>
@@ -1009,11 +1009,11 @@ Named Grid Lines: the <css>(<<custom-ident>>*)</css> syntax</h4>
10091009
10101010 <pre>
10111011 <style>
1012- #grid {
1012+ #grid {
10131013 display: grid;
10141014 grid-template-columns: (first nav) 150px (main) 1fr (last);
10151015 grid-template-rows: (first header) 50px (main) 1fr (footer) 50px (last);
1016- }
1016+ }
10171017 </style>
10181018 </pre>
10191019
@@ -1067,21 +1067,21 @@ Repeating Rows and Columns: the ''repeat()'' notation</h4>
10671067
10681068 <pre>
10691069 <style>
1070- #grid {
1070+ #grid {
10711071 display: grid;
10721072 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;
10761076 grid-template-rows: 1fr;
1077- }
1077+ }
10781078
1079- /* Equivalent definition. */
1080- #grid {
1079+ /* Equivalent definition. */
1080+ #grid {
10811081 display: grid;
10821082 grid-template-columns: repeat(4, 10px (col-start) 250px (col-end)) 10px;
10831083 grid-template-rows: 1fr;
1084- }
1084+ }
10851085 </style>
10861086 </pre>
10871087 </div>
@@ -1326,14 +1326,14 @@ Resolved Values</h4>
13261326 <div class="example">
13271327 <pre>
13281328 <style>
1329- #grid {
1329+ #grid {
13301330 width: 500px;
13311331 grid-template-columns:
13321332 (a) auto
13331333 (b) minmax(min-content, 1fr)
13341334 (b c d) repeat(2, (e) 40px)
1335- repeat(5, auto);
1336- }
1335+ repeat(5, auto);
1336+ }
13371337 </style>
13381338 <div id="grid">
13391339 <div style="grid-column-start:1; width:50px"></div>
@@ -1462,16 +1462,16 @@ Named Areas: the 'grid-template-areas' property</h3>
14621462
14631463 <pre>
14641464 <style type="text/css">
1465- #grid {
1465+ #grid {
14661466 display: grid;
14671467 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; }
14751475 </style>
14761476 </pre>
14771477 </div>
@@ -1765,78 +1765,78 @@ Sizing Auto-generated Rows and Columns: the 'grid-auto-rows' and 'grid-auto-colu
17651765
17661766 <pre>
17671767 <style type="text/css">
1768- form {
1768+ form {
17691769 display: grid;
17701770 /* Define three columns, all content-sized,
17711771 and name the corresponding lines. */
17721772 grid-template-columns: (labels) auto (controls) auto (oversized) auto;
17731773 grid-auto-flow: row;
1774- }
1775- form > label {
1774+ }
1775+ form > label {
17761776 /* Place all labels in the "labels" column and
17771777 automatically find the next available row. */
17781778 grid-column: labels;
17791779 grid-row: auto;
1780- }
1781- form > input, form > select {
1780+ }
1781+ form > input, form > select {
17821782 /* Place all controls in the "controls" column and
17831783 automatically find the next available row. */
17841784 grid-column: controls;
17851785 grid-row: auto;
1786- }
1786+ }
17871787
1788- #department {
1788+ #department {
17891789 /* Auto place this item in the "oversized" column
17901790 in the first row where an area that spans three rows
17911791 won't overlap other explicitly placed items or areas
17921792 or any items automatically placed prior to this area. */
17931793 grid-column: oversized;
17941794 grid-row: span 3;
1795- }
1795+ }
17961796
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 {
18001800 grid-row: auto;
18011801
18021802 /* Ensure the button area spans the entire grid element
18031803 in the row axis. */
18041804 grid-column: 1 / -1;
18051805 text-align: end;
1806- }
1806+ }
18071807 </style>
18081808 <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>
18321822 </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>
18401840 </form>
18411841 </pre>
18421842 </div>
0 commit comments