Grid Flashcards

1
Q

How do you create a grid?

A

Within the selector for the grid container, set the display property to grid and set the amount of columns, rows or both.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How would you create a grid with 2 columns and 2 rows? What about one with 2 columns, or just 2 rows?

A

grid-template: repeat(2, 1fr) / repeat(2, 100px);
grid-template-rows: repeat(2, 1fr);
grid-template-columns: repeat(2, 1fr);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you create a grid where you define where each grid item is placed on the grid or ‘area’?

A

grid-template-areas: ‘nav’
‘main’
‘footer’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How could you add spacing between the grid columns and rows?

A

grid-gap: 10px

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

For a specific grid item how could you define what column and row it starts and ends at? How about just columns and row?

A

grid-area: 1 / 1 / 5 / 2;
grid-row: 1 / 5;
grid-column: 1 / 2;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How could you make your grid responsive to change the layout of the grid items when the users screen is smaller? Such as mobile users.

A

@media only screen and (max-width: 600px) {
grid-template: 200px / repeat(6, 1fr);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly