CSS Box Model Flashcards

1
Q

What is CSS Box Model

A

Idea that everything in CSS is a box.

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

What makes up the Box in Box Model

A

Inner ‘Content box’, surrounded by ‘Padding’, encased in a ‘Border’. Space between boxes is the ‘Margin’.

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

What CSS properties manipulates the content area?

A

Width and Height

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

Name the main Border Properties

A

Border-width
Border-style
Border-color

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

Define Border-width

A

Controls the thickness of the border

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

Define Border-color

A

Controls the color of the border

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

Define Border-style

A

Controls the line style - dashed, solid, etc.

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

A border of 5px is added to a 200x200 content box. What is the new size of the content box with border?

A

210x210px

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

What property can be set to have the border fit the established width and height parameters of content box?

A

box-sizing: border-box;

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

Write a border shorthand

A

border: width style color;

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

How do you make rounded corners in borders?

A

border-radius: px or %;

border-top-right-radius: 50%
border-bottom-left-radius: 50%

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

If adding multiple values to a border property, which order are the values applied?

A

top-right-bottom-left

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

What is padding?

A

Padding is the space between the content box and the border.

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

List the individual properties for padding.

A

padding-left:
padding-right:
padding-bottom:
padding-top:

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

What is padding shorthand

A

padding: 10px (applies to all sides)
padding: 5px 10px (vertical, horizontal)

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

What is margin?

A

Margin is the spacing outside of a box border between other elements.

17
Q

List the individual properties of margin.

A

margin-top:
margin-right:
margin-bottom:
margin-left:

18
Q

List margin shorthand property

A

Same as padding.

margin: 10px (applies to all sides)
margin: 5px 10px (vertical, horizontal)

19
Q

Define Display property

A

Sets whether an element is treated as a block or inline element.

display: inline;
display: block;

20
Q

What is ignored in the display property ‘display: inline;’

A

Width and height are ignored. Margin and padding push elements away horizontally but not vertically.

21
Q

What is ignored in the display property ‘display: block;’

A

The block element breaks the flow of a document and width, height, margin and padding are all respected.

22
Q

How does ‘display: inline-block;’ behave.

A

Behaves like an inline element but width, height, margin, and padding are all respected.

23
Q

Define percentages as a relative value.

A

Percentages are always relative to some other value. Sometimes the value is from the parent and other times it is a value from the element itself.

Width: 50%; (half the width of the parent)

line-height: 50% (half the font-size of the element itself)

24
Q

Define EM’s.

A

Em’s are relative units.

25
Q

How does em’s relate in font size?

A

In regards to font size, 1em is equal to the parent element. 2em is double the parent element.

26
Q

How does em’s relate to with other elements such as margins or padding?

A

With other properties, 1em is equal to the computed font-size of the element itself.

27
Q

Define rem’s

A

Root EM’s are relative to the root html element’s font-size. If root font-size is 20px, 1 rem is always 20px.

**Does not Stack like nested lists etc.