flexbox Flashcards

1
Q

Why is flexbox in CSS?

A

For a long time floats and positioning were chaotic across browsers.

Flexbox was designed to make it easier to:
**vertically center a block inside its parent

**make all children take up an equal amount of width/height

**make all columns in a layout adopt the same height

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

How do you define a flexbox?

A

display: flex;

this element will have block scope and it’s children are laid out as flex items.

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

What is the flex model?

A

Flex items are laid out along two axis:

Main : defined with flex-direction

Cross: runs perpendicular to the main axis

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

What can you specify with flex-direction?

A

flex-direction: main;

row, row-reverse. [left-to-right, right-to-left]

column, column-reverse

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

What is flex-flow?

A

shorthand for direction and wrapping.

flex-flow: direction wrap;

wrap is [nowrap, wrap, wrap-reverse]

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

How do you align items and content inside a flexbox?

A

align-items, and justify-content

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

What are the align-items options?

A

cross-axis alignment
stretch [default], center, flex-start, flex-end

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

What is the flex property?

A

Shorthand for flex-grow, flex-shrink, and flex-basis

/* Three values: flex-grow | flex-shrink | flex-basis */
flex: 2 2 10%;

/* Keyword values */
flex: auto;
flex: initial;
flex: none;

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

What does justify-content control?

A

main-axis alignment

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

what is flex-basis?

A

controls the initial size of the element before additional space is distributed.

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

what is flex-grow?

A

controls the amount of available space an element could take up

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

what is flex-shrink?

A

if items are larger than the container, they shrink according to flex shrink.

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