CSS grid Flashcards

1
Q

What is CSS grid?

A

CSS Grid Layout (aka “Grid” or “CSS Grid”), is a two-dimensional grid-based layout system.

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

How do you set the grid column and row sizes ?

A

set the column and row sizes with grid-template-columns and grid-template-rows

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

What is the first step using CSS grid?

A

Creating a container with…

display: grid
.

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

What does grid-template-columns determine the size of?

A

The width of the columns.

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

What does grid-template-rows determine the size of?

A

The height of the rows.

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

What layout results from this code?

display: grid;
grid-template-columns: 100px auto;
grid-template-rows: 50px 50px auto;

A

grid-template-columns says that there will be 2 columns. The first column is 100px wide and the second takes up the remaining horizontal space available.
grid-template-rows says that their will be three rows. The first two will have a height of 50px and the third row will take up the remaining vertical space.

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

If you give this container 8 child elements what happens to the layout?

#container {
  display: grid;
  grid-template-columns: 100px 100px;
  grid-template-rows: 50px 50px;
  height: 100vh;
}
A

There will be 2 columns 100px wide.
The first two rows will be 50px high. The last two rows will equally share the remaining available vertical space. As a height was not specified for the remaining rows the default auto is used.

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

What will the layout be with the following rules?

#container {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: ;
  height: 100vh; 
}
A

two columns that equally share the available horizontal space. The rows will also share available vertical height among the elements as the default height is auto for grid rows.

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

What is the grid-template property?

A

The grid-template CSS property is a shorthand property for defining grid columns, rows, and areas.

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

What is the grid-template property?

A

The grid-template CSS property is a shorthand property for defining grid columns, rows, and areas.

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

What is a good way to remember the argument you give to grid-template property?

A

Like drawing an L !!!

Draw the line down first ( rows ) and then the line across ( columns )

grid-template: repeat(4, 50px) / repeat(3, 1fr);

Always have a massive row first!!!!

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

If you have 2 columns how many column lines do you have?

A

3

column1 | column2 |

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

What is the grid-column property?

A

This property is a shorthand for the following CSS properties:

grid-column-start
grid-column-end

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

What does this property do?

grid-column: 1 / span 2;

A

it says that the element should start at column line 1 and span 2 columns. equivalent to

grid-column: 1 / 3;

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

What does this property do?

#footer {
  grid-column: 1/-1;
}
A

It says that the element should start at the first column line and end at the last column line.

If you think in a circular way this makes sense.

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