The Box Model Flashcards

1
Q

What are the 5 things of the box model

A

Margin, Border, Padding, Width and Height (Content)

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

Width and Height

A

The width and height of the content area

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

Padding

A

The amount of space between the content area and the border

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

Border

A

The thickness and style of the border surrounding the content area and padding

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

Margin

A

The amount of space between the border and the outside of the element

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

How to change the height and width of an element

A

Using the height and width properties
Example:
p {
height: 80px;
width: 240px;
}

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

Border Width

A

The thickness of the border, can be set in pixels or with the keywords thin, medium, or thick

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

Border style

A

The design of the border, there are 10 different ones with the most common being none, dotted, and solid

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

Border color

A

The color of the border

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

How to change how a border looks

A

With the border property
Example:
p {
border: 3px solid coral;
}

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

How to change the border radius?

A

With the border-radius property
Example:
p {
border-radius: 5px;
}

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

How to make a border a perfect circle?

A

By setting the height and width to be the same, then making the border radius’ value 50%

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

How do you change how large the padding is?

A

Using the padding property
Example:
h1 {
padding: 10px;
}

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

How do you change the amount of padding on each side?
For 4, 3, and 2 value

A

By adding multiple numbers
Example:
h1 {
padding: 5px 10px 15px 5px <em>This would mean (top, right, bottom, left)</em>
}
For 3 values, the middle value would set the left and right padding
For 2 values, the first one sets the top and bottom, and the second one does right and left.
*** also works for margin

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

How to change the margin of an element

A

Using the margin property
Ex:
p {
margin: 20px;
}

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

How to change the margin on only one specific side?

A

Using the margin-right, top, bottom, or left property
Example:
p {
margin-bottom: 15px;
}

17
Q

What does the auto value do?

A

You add it in the margin property after setting a width and it will center the element in the margins. The margin must be set to zero first
Ex:
p {
width: 400px;
margin: 0 auto;
}

18
Q

How to limit how wide or tall something is?

A

With the min-width, max-width, min-height, and max-height property
Example:
p {
min-width: 300px;
max-width: 600px;
}

19
Q

Why would you want to limit how wide or tall something is?

A

To stop it from distorting to much if it is on another screen

20
Q

How to stop overflow?

A

Using the overflow property, you can set it to hide, scroll, and visible(the default one)
Example:
p {
overflow: scroll;
}

21
Q

What is the first thing you usually do when coding in CSS

A

set the margin and padding of everything to 0

22
Q

How to change the visibility of an element

A

Using the visibility property with the value hidden, visible, and collapse
Example:
p {
visibility: hidden;
}