FlexBox Flashcards

1
Q

How do you initiate flexbox?

A

Display: flex

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

Make containers within main container into columns or rows?

A

flex-direction: row
flex-direction: row-reverse
flex-direction: column
flex-direction: column-reverse

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

Describe the flex-box axes.

A
Main = x
Cross = y
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does justify content do?

A

Distributes content across main axis. Imagine boxes distributed horizontally
|■ ■ ■ ■|

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

Default justify content distribution?

A

justify-content: flex-start

|■ ■ ■ |

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

Name 6 justify-content properties

A

justify-content:

a) flex-start
b) flex-end
c) center
d) space-between
e) space-around
f) space-evenly

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

Describe this justify content:

|■ ■ ■ |

A

justify-content: flex-start

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

Describe this justify content:

| ■ ■ ■|

A

justify-content: flex-end

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

Describe this justify content:

| ■ ■ ■ |

A

justify-content: center

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

Describe this justify content:

|■ ■ ■|

A

justify-content: space-between

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

Describe this justify content:

| ■ ■ ■ |

A

justify-content: space-around

left & right only have half as much space

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

Describe this justify content:

| ■ ■ ■ |

A

justify-content: space-evenly

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

What are the first 3 flexbox properties to initialize your design?

A
  1. Display: flex;
  2. flex-direction: row;
  3. Set size of child elements and parent elements
  4. justify-content: space-evenly,
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does flex-wrap do?

A

Determines if elements will wrap along main axis onto a new line (if horizontal) or new column (if vertical)

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

What is the default flex-wrap property value

A

flex-wrap: nowrap

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

Describe

flex-wrap: nowrap

A
_
■
■
■
■
■
_
17
Q

Describe
flex-wrap: wrap

from:
_
■
■
■
■
■
_
A

_
■ ■ ■
■ ■
_

18
Q

Describe

flex-wrap: wrap-reverse

A

If you had a column of containers, it’ll make it so that the containers fill on the right side first, then remaining columns wrap to the middle.

If you had a row of containers, it’ll make it so that the containers fill on the bottom and then wrap to the middle

19
Q

Name the first 4 flex properties

A
  1. Display: flex
  2. Flex-direction: row, row-reverse, column, column-reverse
  3. Set size of child elements and parent element
  4. Justify content: flex-start, flex-end, center, space-between, space-around, space-evenly - SET DISTRIBUTION OF YOUR WRAP
  5. flex-wrap: nowrap (decide if you want contents to wrap)
20
Q

Describe Align-Items

A

Align items for distributing content along the cross axis [y]. Similar to justify-content which is to distribute along main axis [x].

21
Q

Name different align-item property values

A
  1. flex-start (top if row, side if column)
  2. flex-end
  3. center
  4. baseline (aligns bottom of content)
22
Q

Describe align-content

A

distribute space along cross axis [y] but only when we have multiple rows or columns

align-content: flex-start:

__________
■ ■ ■
■ ■
__________

23
Q

Name align-content property values

A

flex-start
space-between
flex-end
flex-center

24
Q

Describe align-self

A

Changing the alignment of one container in a set of containers
■ ■ ■ ■ ■

25
Q

Describe flex-basis

A

This sets the initial size of an element before it is placed in the flex container.

26
Q

Describe flex-grow

A

If there is space left in the flex-container, we can determine how the boxes fill up the remaining space (proportions). One box could have flex-grow: 1, another could have flex-grow: 5, etc and they would all grow in that proportion. Set a min-width property on each box so that each box will AT LEAST be that big. So as you shrink you window, each box will only shrink to its min-width. As you grow the window, each window will grow according to its flex-grow proportion.

Determines the rate at which boxes grow as the browser gets bigger. This will override size properties and make your boxes grow to take up available space in the parent container. So you can make 3 squares sitting next to each other take up the entire parent container in various ratios. As you resize the parent container (via changing the window size) the boxes will revert to their size properties

27
Q

Describe flex-shrink

A

Determines the rate at which the boxes shrink as the browser gets smaller.

So if we start with the wrapper having a width: 100%, max-width: 1000px.

We’d set our 3 boxes to have a width of 333px so each takes up 1/3.

Then we could add a flex-shrink in different proportions so each box will shrink at different rates.

FYI, netninja says he doesn’t really use flex shink

28
Q

What width property goes with flex-grow?

A

min-width: XXpx;

As page gets smaller, the boxes will revert back to the minimum width specified. As page gets larger, the boxes will grow.

29
Q

What width property goes with flex-shink?

A

max-width: XXpx;

As page gets larger, boxes will revert back to their max width. As page gets smaller, they will shrink to your specified ratio.

30
Q

What happens if you make the window larger or smaller?

.flex-container{
display: flex;
flex-wrap: wrap;
}

.box{
height: 100px
min-width: 200px;
flex-grow: 1;

A

Larger:

Smaller:

31
Q

How do you use flex-wrap with flex-grow?

A

Flex container has wrap. Boxes have flex-grow with a minimum width defined. As window shrinks, when boxes can’t shrink anymore (min width constraint), they will wrap to the next line.

32
Q

Describe flex-basis?

A

Flex-basis is similar to minimum width in that it gives a starting width. But when you apply a grow property of 1, they’ll grow according to their flex-basis ratios. Another difference is that if you shrink a window when your boxes have a min-width, it’ll eventually make you scroll. Flex basis will shrink as normal flex items.

33
Q

How do you combine flex-basis, flex-grow, and flex-shrink?

A

flex: grow shrink basis

This one will set grow & shrink to 1 but basis to 0
flex: 1

Example:
flex-container{
display: flex;
flex-wrap;
}

.box{
flex: 1 0 200px;
}

Boxes will wrap at 200px

34
Q

Describe how to make a navigation bar using flex

A

nav ul{
display: flex;
justify-content: flex-start;
}

nav li{
flex: 1 1 0;
}

35
Q

Use flex display on your flex container ul tag so that all of your li tags become flex elements

A

f