Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Grid Layout Going Further with Grid Layout Placing Elements Using Grid Template Areas

Grid Layout

How do I add content to the grid areas.Do make the items of the grid also display grid?

1 Answer

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

A grid area is simply an element that has been given a style of display: grid and its list items the grid-area property,.

The grid items (which are descendent elements of the grid container are given a grid-area property. You don't need to use display: grid again as descendent elements take on the properties of their parents.

You can do something like this to start learning how to get the best out of grid areas.


  <div id="area_one"> content </div>
  <div id="area_one"> content </div>
  <div id="area_three"> content </div>

main {
    display: grid;

        "area_one area_two",
        "area_three area_three" 

main #grid_one {
    grid-area: area_one

main #grid_two {
    grid-area: area_two

main #grid_three {
    grid-area: area_three