CSS Grid Flashcards

1
Q

How do you create a grid element?

A

display: grid

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

How do you add columns to a grid?

A

grid-template-columns:

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

How do you add rows to a grid?

A

grid-template-rows:

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

What units can you use to define the sizes of colums and rows?

A

px, em for set sizes
fr: sets the column or row to a fraction of the available space,

auto: sets the column or row to the width or height of its content automatically,

%: adjusts the column or row to the percent width of its container.

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

How do you add a gap between columns or rows?

A

grid-column-gap:

grid-row-gap:

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

What does grid-gap: do if you pass it one value?

A

Creates a gap between both columns and rows of the specified size

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

How do you align content vertically in the cell of a CSS grid?

A

justify-self:

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

What are the possible values of justify-self:?

A

stretch, which will make the content fill the whole width of the cell. This CSS Grid property accepts other values as well:

start: aligns the content at the left of the cell,
center: aligns the content in the center of the cell,
end: aligns the content at the right of the cell.

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

How do you align content horizontally in the cell of a CSS grid?

A

align-self:

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

How can you group grid cells into areas?

A

grid-template-areas:
“header header header”
“advert content content”
“footer footer footer”;

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

How do you designate an empty space in an area template?

A

.

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

How do you place an element with a given class in an area

A

.class-name {
grid-area: area;
}

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

How can you create an area template?

A

grid-area: 1/1/2/4;

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

what values do the numbers represent in grid-area: 1/1/2/4;?

A

grid-area: horizontal line to start at / vertical line to start at / horizontal line to end at / vertical line to end at;

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

what function can be used to create multiple rows or columns?

A

repeat

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

how do you use the repeat function?

A

repeat(number of rows, size of rows);

17
Q

What function is used to limit the size of items when the grid container changes size?

A

minmax(min-size),(max size))

18
Q

What option does the repeat function have to automatically insert as many rows and columns as possible?

A

auto-fill

19
Q

How is auto-fit different from auto-fill?

A

auto-fit works almost identically to auto-fill. The only difference is that when the container’s size exceeds the size of all the items combined, auto-fill keeps inserting empty rows or columns and pushes your items to the side, while auto-fit collapses those empty rows or columns and stretches your items to fit the size of the container.