> For the complete documentation index, see [llms.txt](https://learncss.gitbook.io/cssadvand/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learncss.gitbook.io/cssadvand/column-grid-full-example-responsive.md).

# Column Grid full example(Responsive)

https\://www\.quackit.com/html/templates/css\_grid\_templates.cfm

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FXUio3mzNslqdtPopZIpQ%2FScreenshot_1.png?alt=media&amp;token=608e132e-5f68-4dc9-ac40-57280893332f" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
.grid {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  grid-template-columns: repeat(12, 1fr);
  grid-gap: 10px;
}
.box {
  color: white;
  font-size: 4vw;
  padding: 10px;
  background: gold;
  text-align: center;
}
.box:nth-child(1) {
  grid-column: span 12;
  }
.box:nth-child(2), 
.box:nth-child(3) {
  grid-column: span 6;
  }
.box:nth-child(4),
.box:nth-child(5),
.box:nth-child(6) {
  grid-column: span 4;
  }
.box:nth-child(7),
.box:nth-child(8),
.box:nth-child(9),
.box:nth-child(10) {
  grid-column: span 3;
  }
.box:nth-child(11),
.box:nth-child(12),
.box:nth-child(13),
.box:nth-child(14),
.box:nth-child(15),
.box:nth-child(16) {
  grid-column: span 2;
  }
@media screen and (max-width: 575px) {
    .grid {
      display: block;
      }
    .box {
      margin: 10px 0;
    }
  }
</style>
<main class="grid">
  <div class="box">1</div>
  <div class="box">2</div>
  <div class="box">3</div>
  <div class="box">4</div>
  <div class="box">5</div>
  <div class="box">6</div>
  <div class="box">7</div>
  <div class="box">8</div>
  <div class="box">9</div>
  <div class="box">10</div>
  <div class="box">11</div>
  <div class="box">12</div>
  <div class="box">13</div>
  <div class="box">14</div>
  <div class="box">15</div>
  <div class="box">16</div>
  <div class="box">17</div>
  <div class="box">18</div>
  <div class="box">19</div>
  <div class="box">20</div>
  <div class="box">21</div>
  <div class="box">22</div>
  <div class="box">23</div>
  <div class="box">24</div>
  <div class="box">25</div>
  <div class="box">26</div>
  <div class="box">27</div>
  <div class="box">28</div>
</main>
```

#### 12 Column Grid (Mobile First)

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FpeC6s2nKGlzzezlRIkyh%2FScreenshot_2.png?alt=media&amp;token=ea8b4482-a244-488e-aa00-79de152f62f9" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
  .grid {
    display: block;
    }
  .box {
    color: white;
    font-size: 4vw;
    padding: 10px;
    background: yellowgreen;
    margin: 10px 0;
    text-align: center;
    }
  @media screen and (min-width: 576px) {
    .grid {
      display: grid;
      grid-template-rows: repeat(6, 1fr);
      grid-template-columns: repeat(12, 1fr);
      grid-gap: 10px;
      }
    .box {
      margin: 0;
      }
    .box:nth-child(1) {
      grid-column: span 12;
      }
    .box:nth-child(2), 
    .box:nth-child(3) {
      grid-column: span 6;
      }
    .box:nth-child(4),
    .box:nth-child(5),
    .box:nth-child(6) {
      grid-column: span 4;
      }
    .box:nth-child(7),
    .box:nth-child(8),
    .box:nth-child(9),
    .box:nth-child(10) {
      grid-column: span 3;
      }
    .box:nth-child(11),
    .box:nth-child(12),
    .box:nth-child(13),
    .box:nth-child(14),
    .box:nth-child(15),
    .box:nth-child(16) {
      grid-column: span 2;
      }
    }
</style>
<main class="grid">
  <div class="box">1</div>
  <div class="box">2</div>
  <div class="box">3</div>
  <div class="box">4</div>
  <div class="box">5</div>
  <div class="box">6</div>
  <div class="box">7</div>
  <div class="box">8</div>
  <div class="box">9</div>
  <div class="box">10</div>
  <div class="box">11</div>
  <div class="box">12</div>
  <div class="box">13</div>
  <div class="box">14</div>
  <div class="box">15</div>
  <div class="box">16</div>
  <div class="box">17</div>
  <div class="box">18</div>
  <div class="box">19</div>
  <div class="box">20</div>
  <div class="box">21</div>
  <div class="box">22</div>
  <div class="box">23</div>
  <div class="box">24</div>
  <div class="box">25</div>
  <div class="box">26</div>
  <div class="box">27</div>
  <div class="box">28</div>
</main>
```

#### 12 Column Grid Example 2 (Responsive)

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2F60e329IgaZMVEyOtTpx5%2FScreenshot_3.png?alt=media&amp;token=518d6e1e-5568-44e1-9c53-a51f0de897ae" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
  .grid {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    grid-template-columns: repeat(12, 1fr);
    grid-gap: 10px;
  }
  .box {
    color: white;
    padding: 7px;
    background: gold;
    text-align: center;
    }
  .box:nth-child(2),
  .box:nth-child(21) {
    grid-column: span 11;
    }
  .box:nth-child(3),
  .box:nth-child(20) {
    grid-column: span 2;
    }
  .box:nth-child(4),
  .box:nth-child(19) {
    grid-column: span 10;
    }
  .box:nth-child(5),
  .box:nth-child(18) {
    grid-column: span 3;
    }
  .box:nth-child(6),
  .box:nth-child(17) {
    grid-column: span 9;
    }
  .box:nth-child(7),
  .box:nth-child(16) {
    grid-column: span 4;
    }
  .box:nth-child(8),
  .box:nth-child(15) {
    grid-column: span 8;
    }
  .box:nth-child(9),
  .box:nth-child(14) {
    grid-column: span 5;
    }
  .box:nth-child(10),
  .box:nth-child(13) {
    grid-column: span 7;
    }
  .box:nth-child(11),
  .box:nth-child(12) {
    grid-column: span 6;
    }
  @media screen and (max-width: 575px) {
    .grid {
      display: block;
    }
    .box {
      margin: 10px 0;
    }
  }
</style>
<main class="grid">
  <div class="box">1</div>
  <div class="box">2</div>
  <div class="box">3</div>
  <div class="box">4</div>
  <div class="box">5</div>
  <div class="box">6</div>
  <div class="box">7</div>
  <div class="box">8</div>
  <div class="box">9</div>
  <div class="box">10</div>
  <div class="box">11</div>
  <div class="box">12</div>
  <div class="box">13</div>
  <div class="box">14</div>
  <div class="box">15</div>
  <div class="box">16</div>
  <div class="box">17</div>
  <div class="box">18</div>
  <div class="box">19</div>
  <div class="box">20</div>
  <div class="box">21</div>
  <div class="box">22</div>
</main>
```

#### 12 Column Grid Example 2 (Mobile First)

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2F4LdU4zfoo6kE4ZWet9oE%2FScreenshot_4.png?alt=media&amp;token=db22af78-f4bf-439b-82ff-575c03046703" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
  .grid {
    display: block;
  }
  .box {
    color: white;
    padding: 7px;
    background: yellowgreen;
    margin: 10px 0;
    text-align: center;
  }
  @media screen and (min-width: 576px) {
    .grid {
      display: grid;
      grid-template-rows: repeat(6, 1fr);
      grid-template-columns: repeat(12, 1fr);
      grid-gap: 10px;
    }
    .box {
      margin: 0;
    }
    .box:nth-child(2),
    .box:nth-child(21) {
      grid-column: span 11;
      }
    .box:nth-child(3),
    .box:nth-child(20) {
      grid-column: span 2;
      }
    .box:nth-child(4),
    .box:nth-child(19) {
      grid-column: span 10;
      }
    .box:nth-child(5),
    .box:nth-child(18) {
      grid-column: span 3;
      }
    .box:nth-child(6),
    .box:nth-child(17) {
      grid-column: span 9;
      }
    .box:nth-child(7),
    .box:nth-child(16) {
      grid-column: span 4;
      }
    .box:nth-child(8),
    .box:nth-child(15) {
      grid-column: span 8;
      }
    .box:nth-child(9),
    .box:nth-child(14) {
      grid-column: span 5;
      }
    .box:nth-child(10),
    .box:nth-child(13) {
      grid-column: span 7;
      }
    .box:nth-child(11),
    .box:nth-child(12) {
      grid-column: span 6;
      }
  }
</style>
<main class="grid">
  <div class="box">1</div>
  <div class="box">2</div>
  <div class="box">3</div>
  <div class="box">4</div>
  <div class="box">5</div>
  <div class="box">6</div>
  <div class="box">7</div>
  <div class="box">8</div>
  <div class="box">9</div>
  <div class="box">10</div>
  <div class="box">11</div>
  <div class="box">12</div>
  <div class="box">13</div>
  <div class="box">14</div>
  <div class="box">15</div>
  <div class="box">16</div>
  <div class="box">17</div>
  <div class="box">18</div>
  <div class="box">19</div>
  <div class="box">20</div>
  <div class="box">21</div>
  <div class="box">22</div>
</main>
```

#### 12 Column Vertical Grid (Responsive)

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FNOLiTxezKAaGQhrcAJzZ%2FScreenshot_5.png?alt=media&amp;token=96f8a910-92b1-4ab6-8f4f-bb3306fd96f4" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
  .grid {
    display: grid;
    grid-template-rows: repeat(12, 1fr);
    grid-template-columns: repeat(6, 1fr);
    grid-auto-flow: column;
    grid-gap: 10px;
    }
  .box {
    color: white;
    font-size: 2vh;
    padding: 10px;
    background: gold;
    margin: 0;
    text-align: center;
    }
  .box:nth-child(1) {
    grid-row: span 12;
    }
  .box:nth-child(2), 
  .box:nth-child(3) {
    grid-row: span 6;
    }
  .box:nth-child(4),
  .box:nth-child(5),
  .box:nth-child(6) {
    grid-row: span 4;
    }
  .box:nth-child(7),
  .box:nth-child(8),
  .box:nth-child(9),
  .box:nth-child(10) {
    grid-row: span 3;
    }
  .box:nth-child(11),
  .box:nth-child(12),
  .box:nth-child(13),
  .box:nth-child(14),
  .box:nth-child(15),
  .box:nth-child(16) {
    grid-row: span 2;
    }
  @media screen and (max-width: 575px) {
    .grid {
      display: block;
      }
    .box {
      margin: 10px 0;
    }
    }
</style>
<main class="grid">
  <div class="box">1</div>
  <div class="box">2</div>
  <div class="box">3</div>
  <div class="box">4</div>
  <div class="box">5</div>
  <div class="box">6</div>
  <div class="box">7</div>
  <div class="box">8</div>
  <div class="box">9</div>
  <div class="box">10</div>
  <div class="box">11</div>
  <div class="box">12</div>
  <div class="box">13</div>
  <div class="box">14</div>
  <div class="box">15</div>
  <div class="box">16</div>
  <div class="box">17</div>
  <div class="box">18</div>
  <div class="box">19</div>
  <div class="box">20</div>
  <div class="box">21</div>
  <div class="box">22</div>
  <div class="box">23</div>
  <div class="box">24</div>
  <div class="box">25</div>
  <div class="box">26</div>
  <div class="box">27</div>
  <div class="box">28</div>
</main>
```

#### 12 Column Vertical Grid (Mobile First)

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FwxHAxhqfRboHeUEgcgaq%2FScreenshot_6.png?alt=media&amp;token=b132fab0-d18c-468d-8800-792ef2449aa2" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
  .grid {
    display: block;
    }
  .box {
    color: white;
    font-size: 2vh;
    padding: 10px;
    background: yellowgreen;
    margin: 10px 0;
    text-align: center;
    }
  @media screen and (min-width: 576px) {
    .grid {
      display: grid;
      grid-template-rows: repeat(12, 1fr);
      grid-template-columns: repeat(6, 1fr);
      grid-auto-flow: column;
      grid-gap: 10px;
      }
    .box {
      margin: 0;
      }
    .box:nth-child(1) {
      grid-row: span 12;
      }
    .box:nth-child(2), 
    .box:nth-child(3) {
      grid-row: span 6;
      }
    .box:nth-child(4),
    .box:nth-child(5),
    .box:nth-child(6) {
      grid-row: span 4;
      }
    .box:nth-child(7),
    .box:nth-child(8),
    .box:nth-child(9),
    .box:nth-child(10) {
      grid-row: span 3;
      }
    .box:nth-child(11),
    .box:nth-child(12),
    .box:nth-child(13),
    .box:nth-child(14),
    .box:nth-child(15),
    .box:nth-child(16) {
      grid-row: span 2;
      }
    }
</style>
<main class="grid">
  <div class="box">1</div>
  <div class="box">2</div>
  <div class="box">3</div>
  <div class="box">4</div>
  <div class="box">5</div>
  <div class="box">6</div>
  <div class="box">7</div>
  <div class="box">8</div>
  <div class="box">9</div>
  <div class="box">10</div>
  <div class="box">11</div>
  <div class="box">12</div>
  <div class="box">13</div>
  <div class="box">14</div>
  <div class="box">15</div>
  <div class="box">16</div>
  <div class="box">17</div>
  <div class="box">18</div>
  <div class="box">19</div>
  <div class="box">20</div>
  <div class="box">21</div>
  <div class="box">22</div>
  <div class="box">23</div>
  <div class="box">24</div>
  <div class="box">25</div>
  <div class="box">26</div>
  <div class="box">27</div>
  <div class="box">28</div>
</main>
```

#### Grid Layout 1

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FqO5bSb39gsvUXOhOgx1d%2FScreenshot_7.png?alt=media&amp;token=a58c9290-3aa3-4396-b3fb-b583b0ec2f73" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>CSS Grid Template 1</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "header header header"
    "nav article ads"
    "nav footer footer";
  grid-template-rows: 80px 1fr 70px;  
  grid-template-columns: 20% 1fr 15%;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: gold;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 2

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FOo8pb5VMMuH4p0fRRjtH%2FScreenshot_8.png?alt=media&amp;token=fdb69f92-6b2e-48ae-bd15-074a2c0f8033" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>CSS Grid Template 2</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "header header header"
    "nav article ads"
    "footer footer footer";
  grid-template-rows: 80px 1fr 70px;  
  grid-template-columns: 20% 1fr 15%;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: gold;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 3

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2F8PcpqT8FLKkvqnVNTa12%2FScreenshot_9.png?alt=media&amp;token=ae023612-25f7-49d2-87b3-ce5bd13ae153" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>CSS Grid Template 3</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "header header header"
    "article nav ads"
    "footer footer footer";
  grid-template-rows: 80px 1fr 70px;  
  grid-template-columns: 1fr 20% 15%;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: gold;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 4

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FHQtj86Culr9WgbdzdnYI%2FScreenshot_10.png?alt=media&amp;token=ad8d782d-864c-4462-9d66-502348a565d0" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>CSS Grid Template 4</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "header header header"
    "article nav ads"
    "footer nav ads";
  grid-template-rows: 80px 1fr 70px;  
  grid-template-columns: 1fr 20% 15%;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: gold;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 5

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FjLioCaFjzcBpbtZzAZMB%2FScreenshot_11.png?alt=media&amp;token=0b803db1-1501-48db-b8c4-c36870475481" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>CSS Grid Template 5</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "nav header header"
    "nav article ads"
    "nav footer footer";
  grid-template-rows: 80px 1fr 70px;  
  grid-template-columns: 20% 1fr 15%;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: gold;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 6

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FuYSF5lMXvpgh4ZGYoL2b%2FScreenshot_12.png?alt=media&amp;token=c2cd9f7d-05ce-4e8d-8817-c9be51447b49" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>CSS Grid Template 6</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "header header"
    "nav article"
    "nav ads"
    "footer footer";
  grid-template-rows: 80px 1fr 70px 70px;  
  grid-template-columns: 20% 1fr;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: yellowgreen;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 7

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2Fynh6b0CRP7jasbpJHQRt%2FScreenshot_13.png?alt=media&amp;token=9e253316-fa83-4a85-9229-327f98ccb32c" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>CSS Grid Template 7</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "nav header"
    "nav article"
    "nav ads"
    "nav footer";
  grid-template-rows: 80px 1fr 70px 70px;  
  grid-template-columns: 20% 1fr;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: yellowgreen;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 8

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2F9DUvTmCKfVXLtQ2FfQ5r%2FScreenshot_14.png?alt=media&amp;token=b376bc93-b21b-4c00-bb1d-f337b04199b5" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>CSS Grid Template 8</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "header header"
    "ads article"
    "nav article"
    "nav footer";
  grid-template-rows: 80px 120px 1fr 70px;  
  grid-template-columns: 20% 1fr;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: yellowgreen;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 9

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FIKgi9sYRz8EACRmQ2502%2FScreenshot_15.png?alt=media&amp;token=bdf2d497-5af5-41fc-aae2-0d3cfb72671c" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>CSS Grid Template 9</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "header header"
    "nav article"
    "ads article"
    "ads footer";
  grid-template-rows: 80px 1fr 120px 70px;  
  grid-template-columns: 20% 1fr;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: yellowgreen;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 10

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FNhOM2qc2IStFt4EcpSEv%2FScreenshot_16.png?alt=media&amp;token=58955177-6391-4e02-af9f-581cb6a8ed6b" alt=""><figcaption></figcaption></figure>

```
<!doctype html>
<title>CSS Grid Template 10</title>
<style>
body { 
  display: grid;
  grid-template-areas: 
    "header header ads"
    "nav article article"
    "nav footer footer";
  grid-template-rows: 80px 1fr 70px;  
  grid-template-columns: 20% 1fr 15%;
  grid-row-gap: 10px;
  grid-column-gap: 10px;
  height: 100vh;
  margin: 0;
  }  
header, footer, article, nav, div {
  padding: 1.2em;
  background: yellowgreen;
  }
#pageHeader {
  grid-area: header;
  }
#pageFooter {
  grid-area: footer;
  }
#mainArticle { 
  grid-area: article;      
  }
#mainNav { 
  grid-area: nav; 
  }
#siteAds { 
  grid-area: ads; 
  } 
/* Stack the layout on small devices/viewports. */
@media all and (max-width: 575px) {
  body { 
    grid-template-areas: 
      "header"
      "article"
      "ads"
      "nav"
      "footer";
    grid-template-rows: 80px 1fr 70px 1fr 70px;  
    grid-template-columns: 1fr;
 }
}
</style>
<body>
  <header id="pageHeader">Header</header>
  <article id="mainArticle">Article</article>
  <nav id="mainNav">Nav</nav>
  <div id="siteAds">Ads</div>
  <footer id="pageFooter">Footer</footer>
</body>
```

#### Grid Layout 11

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2Fhdua91gvWOw0UV7tZkIE%2FScreenshot_17.png?alt=media&amp;token=b703fd80-09e2-430c-a421-4707114e2a7d" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
#grid {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 10px;
  height: 100vh;
  margin: 0;
}
#grid > div {
  color: white;
  font-size: 4vw;
  padding: 10px;
  background: gold;
}
#grid > div:nth-child(1) {
  grid-column: span 4;
  }
#grid > div:nth-child(2) {
  grid-row: span 4;
  }
#grid > div:nth-child(4) {
  grid-column: span 2;
  }
#grid > div:nth-child(5) {
  grid-column: span 2;
  }
#grid > div:nth-child(10) {
  grid-column: span 3;
  }
</style>
<body id="grid">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
  <div>6</div>
  <div>7</div>
  <div>8</div>
  <div>9</div>
  <div>10</div>
</body>
```

#### Grid Layout 12

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FAQU6P7oPSY7U96OzPWgR%2FScreenshot_18.png?alt=media&amp;token=6757e1e1-f3d9-40b0-ae57-927270734dd2" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
#grid {
  display: grid;
  grid-template-rows: 50vh repeat(4, 1fr);
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 10px;
  height: 100vh;
  margin: 0;
}
#grid > div {
  color: white;
  font-size: 4vw;
  padding: 10px;
  background: gold;
}
#grid > div:nth-child(1) {
  grid-column: span 4;
  }
#grid > div:nth-child(2) {
  grid-row: span 4;
  }
#grid > div:nth-child(4) {
  grid-row: span 2;
  }
#grid > div:nth-child(5) {
  grid-row: span 3;
  }
#grid > div:nth-child(6) {
  grid-row: span 3;
  }
</style>
<body id="grid">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
  <div>6</div>
  <div>7</div>
  <div>8</div>
  <div>9</div>
</body>
```

#### Form with Auto Placement

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2Fnp0pxArGUdcZ0hGPJ63P%2FScreenshot_19.png?alt=media&amp;token=9bcf8179-397d-4643-bf97-7e9b7ad9fdd3" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Form template with CSS grid auto placement</title>
<link href="https://fonts.googleapis.com/css?family=Unkempt" rel="stylesheet">
<style>
  .myForm > * {
   font: 1.4em 'Unkempt', sans-serif; 
  }
  .myForm {
    display: grid;
    grid-template-columns: [labels] auto [controls] 1fr;
    grid-auto-flow: row;
    grid-gap: .8em .5em;
    background: beige;
    padding: 1.2em;
    width: 36em;
  }
  .myForm > label,
  .myForm > fieldset  {
    grid-column: labels;
    grid-row: auto;
  }
  .myForm > input, 
  .myForm > select,
  .myForm > textarea {
    grid-column: controls;
    grid-row: auto;
    padding: .4em;
    border: 0;
  }
  .myForm > fieldset,
  .myForm > button {
    grid-column: span 2;
  }  
  .myForm > button {
    padding: 1em;
    background: darkkhaki;
    border: 0;
    color: white;
    }
  .myForm > textarea {
    min-height: 3em;
    }
</style>
<form class="myForm">
  <label for="customer_name">Name </label>
  <input type="text" name="customer_name" id="customer_name" required>

  <label for="phone_number">Phone </label>
  <input type="tel" name="phone_number" id="phone_number">

  <label for="email_address">Email </label>
  <input type="email" name="email_address" id="email_address">

  <fieldset>
    <legend>Which taxi do you require?</legend>
    <label> <input type="radio" name="taxi" id="taxi_car" required value="car"> Car </label>
    <label> <input type="radio" name="taxi" id="taxi_van" required value="van"> Van </label>
    <label> <input type="radio" name="taxi" id="taxi_tuk" required value="tuktuk"> Tuk Tuk </label>
  </fieldset>

  <fieldset>
    <legend>Extras</legend>
    <label> <input type="checkbox" name="extras" id="extras_baby" value="baby"> Baby Seat </label>
    <label> <input type="checkbox" name="extras" id="extras_wheel" value="wheelchair"> Wheelchair Access </label>
    <label> <input type="checkbox" name="extras" id="extras_tip" value="tip"> Stock Tip </label>
  </fieldset>

  <label for="pickup_time">Pickup Date/Time</label>
  <input type="datetime-local" name="pickup_time" id="pickup_time" required>

  <label for="pickup_place">Pickup Place</label>
  <select name="pickup_place" id="pickup_place">
    <option value="" selected="selected">Select One</option>
    <option value="office" >Taxi Office</option>
    <option value="town_hall" >Town Hall</option>
    <option value="telepathy" >We'll Guess!</option>
  </select>

  <label for="dropoff_place">Dropoff Place</label>
  <input type="text" name="dropoff_place" id="dropoff_place" required list="destinations">

  <datalist id="destinations">
    <option value="Airport">
    <option value="Beach">
    <option value="Fred Flinstone's House">
  </datalist>

  <label for="comments">Special Instructions</label>
  <textarea name="comments" id="comments" maxlength="500"></textarea>

  <button>Submit Booking</button>

</form>
```

#### Nested Grid

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FwQ8evDxnX6Mt2ulXVHcY%2FScreenshot_20.png?alt=media&amp;token=cc78535b-5e29-4bbb-a5fb-aa1c323a4d4c" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
#outer-grid {
  display: grid;
  grid-template-rows: 1fr 1fr;
  grid-template-columns: 1fr 1fr;
  grid-gap: 10px;
}
#outer-grid > div {
  background-color: red;
  color: white;
  font-size: 4vw;
  padding: 10px;
}
#inner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 5px;
}
#inner-grid > div {
  background: salmon;
  padding: 10px;
}
</style>
<div id="outer-grid">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div id="inner-grid">
    <div>5</div>
    <div>6</div>
    <div>7</div>
    <div>8</div>
  </div>
</div>
```

#### Repeating Grid

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2FAqqcC624cgCMSVl2p7ZV%2FScreenshot_21.png?alt=media&amp;token=d72888b7-3e80-401d-91b1-c558dfeb57b2" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
#grid {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 10px;
}
#grid > div {
  background-color: hotpink;
  color: white;
  font-size: 4vw;
  padding: 10px;
}
</style>
<div id="grid">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
  <div>6</div>
  <div>7</div>
  <div>8</div>
  <div>9</div>
</div>
```

#### Repeating Grid with Span

<figure><img src="https://1655165672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsqgAqbSGjkO0e50FMT%2Fuploads%2F1wf43nJTdCRuLVmyuvAb%2FScreenshot_22.png?alt=media&amp;token=75ed51b8-8b97-4e93-8001-5f069f26da47" alt=""><figcaption></figcaption></figure>

```html
<!doctype html>
<title>Example</title>
<style>
#grid {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 10px;
}
#grid > div {
  background-color: hotpink;
  color: white;
  font-size: 4vw;
  padding: 10px;
}
#grid > div:nth-child(1) {
  grid-column: span 2;
}
#grid > div:nth-child(2) {
  grid-row: span 4;
}
#grid > div:nth-child(9) {
  grid-column: span 3;
}  
</style>
<div id="grid">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
  <div>6</div>
  <div>7</div>
  <div>8</div>
  <div>9</div>
</div>
```

[<br>](https://www.quackit.com/html/html_editors/scratchpad/preview.cfm?example=/css/grid/examples/12_column_grid_mobile_first)
