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 Position Items by Grid Lines

Eduardo Vargas
Eduardo Vargas
5,871 Points

Which to use: Rows or Columns?

In this particular example, Guil declares the beginning and end of the Header and Footer using "grid-column-start" and "grid-column-end". On the other hand, he declares the Main and Aside using "grid-row-start" and "grid-row-end".

Is there any downside to declaring all of them with the "grid-column-start / end" property or did Guil do it this way for lecture purposes? The grid seems to display the same either way.

.container {
    height: 100vh;
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 100px minmax(200px, 1fr) 100px;
    grid-gap: 10px;
}

header {
    grid-column-start: 1;
    grid-column-end: 3;
}

main {
    grid-column-start: 1;
    grid-column-end: 2;
}

aside {
    grid-column-start: 2;
    grid-column-end: 3;
}

footer {
    grid-column-start: 1;
    grid-column-end: 3;
}

1 Answer

Hi Eduardo,

In this instance, no...there isn't anything wrong with building your layout using only column declarations! You've achieved your desired layout and that's the goal. Once you need to manipulate the number of rows an element spans, then you can employ the grid-row-start/end properties.

Hope this helps! Happy coding!