The Box Model, Block and Inline, Flexbox Flashcards

1
Q

What is the difference between padding, margin, and border?

A

Padding: the space between the content and the borde

Margin: the space between a box and others that sit next to it

Border: the space between the margin and the padding.

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

True or False: If two boxes are next to each other and they both have the margins that are 60px, they stack.

A

False! They do not stack, instead the margins just combine which in this case will result in 60px between the two boxes. Margin’s collapse!

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

What is the difference between Block and Inline elements? What are some examples of those elements?

A

Block elements display as a block and stack on top of each other and start on a new line on a page. Example: <h1> <p> <div>

Inline elements do not display as a block or start on a new line. Instead, they take space inside of a block element. <em> <a> <span></span></a></em>

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

What are the two empty HTML elements that do not have any particular meaning to them and are generic boxes that can contain anything? One is a block element and one is an inline element.

A

<div> and <span>, block and inline in that order.
</span></div>

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

What is Normal Flow?

A

How elements on a web page lay out by default without CSS to change the way they behave.

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

(Flexbox) What is Flexbox and what is it used for?

A

Flexbox is a tool used to format and layout a web page into rows or columns using flex containers and flex items. These items will flex, grow shrink, based on rules you can define.

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

(Flexbox) What is a flex container and a flex item? What is their relationship?

A

A flex container is a box that holds flex items (that are also boxes cuz HTML). Flex items can also be flex containers that can hold flex items!

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

(Flexbox) What is the flex declaration and what are the three properties it is a shorthand for?

A

The flex declaration is a short hand for 3 properties you can set on a flex item: flex-grow, flex-shrink, flex-basis. The flex declaration determines how a flex item flexes or stretches inside a flex container. It usually only contains one value as a shorthand and the declaration is placed into the styling of the container or an individual item.

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

(Flexbox) What does flex-grow do?

A

The first part of the flex shorthand that determines how flex items grow in a flex container.

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

(Flexbox) What does flex-shrink do?

A

The second part of the flex shorthand that determines how flex items shrink in a flex container.

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

(Flexbox) What does flex-basis do?

A

The third part of the flex shorthand that determines the initial size of a flex item. Any sort of growing or shrinking will start from that baseline size.

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

(Flexbox) What are the two axes of a flex container?

A

The main axis (aka the primary axis) that follows the flex direction: row (left to right) or column (top to bottom).

The cross axis is perpendicular to the main axis where the children will be stretched out to fill the entire container along this axis. Opposite directions of the main axis.

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

(Flexbox) What does justify-content property do?

A

Aligns flex items based on the main axis.

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

(Flexbox) What does align-items property do?

A

Align flex items based on the cross axis.

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

(Flexbox) What does the gap property do?

A

Adds a specified space between flex items. Similar to margin!

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