Flexbox Flashcards

1
Q

flex-wrap

A

The container property that dictates if a set of elements will be forced to share the same line, or if they can wrap into multiple lines

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

flex-wrap values

A

nowrap, wrap, or wrap-reverse

ex.
container {
flex-wrap: wrap;
}

“nowrap” is the default

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

flex-direction

A

Property that defines the direction and origin of the main axis.

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

{display: flex;}

A

Property assigned in a container to make it a flex container

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

justify-content

A

Container property that aligns the items in a flex container, there are many values that assign given space differently. (space-around, space-between, etc)

<p>Aligns along the <i>main axis</i>. </p>

Tip: When you see or use “justify-content” think about the main axis and where it is in your code.

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

justify-content values

A
flex-start, flex-end
center 
space-between
space-around 
space-evenly
(initial 
inherit) 

ex.
container {
justify-content: center;
}

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

align-content

A

This container property modifies the behavior of the flex-wrap property - but instead of aligning the flex items, it aligns the flex lines.

Meaning it controls the white space in lines of flex items.

Aligns along the cross axis.

Note: There must be multiple lines of items for this to take effect.

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

flex-direction values

A

row, row-reverse
column, column-reverse
initial
inherit

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

The flexbox module nests ___ elements deep

A

One

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

What property and value must be assigned to an element to make it a flex container?

A

display: flex;

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

Any element nested one level deep in a flex container is considered a what?

A

Flex item

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

What are the two main directions of flex-direction?

A

Row and column.

Row is the default.

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

What CSS property is shorthand for flex-direction and flex-wrap?

A

Flex-flow: DIRECTION-VALUE WRAP-VALUE;

Example

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

The above code will run the children elements in a default row, and wrap them to multiple lines

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

align-items

A

Container property that controls the alignments of the items or elements inside of a flex container.

Tip: When you see align-items or align-content, be mindful of where the cross axis exists in your code.

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

align-content values

A
stretch
flex-start, flex-end
space-around
space-between
center
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

align-items values

A

stretch
flext-start, flex-end
center
baseline

17
Q
.container {
  display: flex;
  justify-content: center;
  align-items: center;
}

What is the basic effect the above code will have in the container class?

A

Content inside the elements should be centered along both the main axis and cross axis - so it will appear in the center-middle of the box.

18
Q

See ‘justify’ think: ____-axis

A

main-axis

19
Q

See ‘align’ think: ____-axis

A

cross-axis

20
Q

space-between

A

<p>This value assigns an even amount of space <strong><u>between</u></strong> elements. </p>

The elements sitting on the beginning and end of the row or column will run alongside the beginning of the row with no margin on the left and right respectively.

21
Q

space-around

A

<p>Assigns equal value <strong><u>around</u></strong> every element, including the elements at the beginning of the row or column, all will have <i>equal space on all sides.</i></p>

22
Q

Flex item properties control what?

A

Item properties control the flex items themselves, and how content will look in each individual flex item.

23
Q

<p>Name some flex <strong><i>item</i></strong> properties:</p>

A
order
flex-grow
flex-shrink
flex-basis 
align-self
24
Q

Name some flex CONTAINER properties

A
flex-direction
justify-content
flex-wrap
align-items 
align-content
25
Q

What does the item property “order” allow devs to do?

A

It allows them to target individual items (child elements in a flex container) and change their order specifically, regardless of where they ‘live’ in the HTML.

The default order given is 0, so anything less than 0 (-1, -2) will come first (or second, third, etc, depending on the number you assign each item).

Assign a number to every element to avoid using negatives if you prefer.

26
Q

What is the {flex-grow: ;} property, and how is it used?

A

This property allows for flex items to take different amounts of available space depending on their importance, or the size of their content.

Example: For a blog you may want the sidebar to be half the size of the main content box, while still sharing the same line.

A number will be assigned to each child.

For example

sidebar {
flex-grow: 1;
}

main-content {
flex-grow: 8;
}

The main-content will take 8x as much of the white space as the sidebar.

Note: Flex-grow uses ratios to assign value

27
Q

What is the {align-self: ;} property?

A

<p>Item property targeting <strong><u>one</u></strong> item inside of a flex container. </p>

Changing an items code to {align-self:flex-end;}, for example, will align the item at the end of the row, even if it comes first in the HTML.

28
Q

What is the {flex-shrink: ;} property?

A

Much like flex-grow, this item property lets a developer assign which elements will shrink more or less than others when screen space (viewport height or width) is limited.

Default value is 1, so negative numbers cannot be used. An element with a flex-shrink of 2 will shrink TWICE AS MUCH as element with a value of 1.

Tip: This property uses ratios to establish value.

29
Q

Why might a developer use the {order: ;} property in flexbox to change the visual order of elements on a page?

A

To improve screen-reader accessibility.

For example, on a blog we would want the screen-reader to convey the main content of the blog before reading the sidebar content.

30
Q

flew-grow grows items along the ___-axis.

A

<p>Flex-grow grows elements by ratios along the <strong><u>main-axis</u></strong></p>

.

31
Q

<p><i>True</i> or <i>False</i>: Flex-grow must be applied to the items themselves?</p>

A

True

Flex-grow only takes place when assigned to the elements inside of a flex container, and it is given value using ratios.

32
Q

Describe what the {object-fit: ;} property does and why it is useful?

A

Object-fit allows for sizing images to fit a container using ratios, which is useful because it preserves the image’s ratios for prettier, non-squished images on the page!

33
Q

Give an example of an {object-fit: ;} value

A
fill
contain
cover
scale-down 
none