Flexbox Flashcards

(20 cards)

1
Q

What is flexbox?

A

A one-dimensional layout model for distributing space between items in rows or columns, with powerful alignment capabilities.

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

How do you create a flex container?

A

Set display: flex (block-level) or display: inline-flex (inline-level) on the container element.

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

What are the two axes in flexbox?

A

The main axis (defined by flex-direction) and the cross axis (perpendicular to the main axis).

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

What is the default value of flex-direction?

A

row — items are laid out horizontally in the inline direction of the current writing mode.

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

What are the four possible values of flex-direction?

A

row, row-reverse, column, and column-reverse.

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

What does flex-wrap do?

A

Controls whether flex items are forced onto a single line or can wrap onto multiple lines. Default is nowrap.

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

What is the flex shorthand property?

A

A shorthand for flex-grow, flex-shrink, and flex-basis — e.g. flex: 1 1 auto.

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

What does flex: initial mean?

A

Equivalent to flex: 0 1 auto — items won’t grow beyond their basis size but can shrink.

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

What does flex: auto mean?

A

Equivalent to flex: 1 1 auto — items can both grow to fill space and shrink if needed.

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

What does flex: none mean?

A

Equivalent to flex: 0 0 auto — items are fully inflexible, they neither grow nor shrink.

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

What does flex: 1 mean?

A

Equivalent to flex: 1 1 0 — items grow proportionally from a flex-basis of zero, sharing available space equally.

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

What property aligns items along the cross axis?

A

align-items — applied to the flex container. Default value is stretch.

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

What property distributes space along the main axis?

A

justify-content — applied to the flex container.

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

What does align-self do?

A

Overrides the container’s align-items value for an individual flex item.

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

How do you vertically and horizontally center a flex item?

A

Set align-items: center and justify-content: center on the flex container.

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

What is the order property?

A

It controls the visual order of flex items without changing the DOM order. Default value is 0; higher values appear later.

17
Q

Do float, clear, and vertical-align work on flex items?

A

No — they have no effect on flex items.

18
Q

What happens when flex items wrap?

A

Each line acts as its own flex container. The align-content property controls spacing between lines.

19
Q

How can you push one flex item to the far end using margins?

A

Set margin-left: auto (in a row direction) on that item — it absorbs all remaining space on the main axis.

20
Q

What is the gap property in flexbox?

A

It sets the spacing between flex items without adding margins. Accepts one value (both axes) or two values (row-gap and column-gap).