Spacing Flashcards

1
Q

On what do margin and padding base their relative size on?

A

If the value used is rem: the root size.

If the value used is em: the font-size of the element they are affecting.

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

When might it be a good time to use em’s.

A

em’s can be useful when we want the padding or margin to scale with font-size in a more dynamic way.

Buttons are a good example.

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

How can the use of em reduce the dependence on complicated media queries

A

By linking many things to the font-size of an element, we can use a media query to change the font-size, thereby styling all components who’s em is based on that font-size

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

What will negative values do with Margin?

A

Negative values will pull an element outside of it containing parent

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

What affect on surround elements can a negative margin have.

A

A negative margin can pull nearby elements closer and this can happen to multiple elements.

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

What does setting the margin to “auto” attempt to do?

A

margin: auto; attempts to fill all available space along the axis with margin. This only works on Horizontal margin

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

What other declaration needs to be made when using margin: auto;

A

margin: auto; only works with elements that have a explicit width.

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

Which element will be affected negative margins on the right or bottom. The element with the declaration or nearby elements

A

Nearby elements will be affected by negative margins on the right and bottom of an element, but it will not affect the element that possess the margin delcaration.

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

What is margin collapse?

A

Margin collapse occurs in certain situations where a larger margin will absorb the smaller margin opposite it.

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

Where does margin collapse occur?

A
  1. Adjacent siblings
  2. Completely empty box
  3. Parents and first or last child elements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you choose whether to use margin or padding on an element?

A

Use margin if you want more empty space.

Use padding when you want more background.

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