Spacing Flashcards

1
Q

What HTML element creates a line break, similar to pressing the enter key?

A

<br></br>

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

What HTML element creates a line break, similar to pressing the enter key?

A

<hr></hr>

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

What does the margin property do?

A

Adds space outside an element, like a cushion around it.

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

What are the four margin shorthand properties?

A

margin-top, margin-right, margin-bottom, margin-left

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

How can margin values be defined?

A

Length, percentage (based on containing block’s width), or auto.

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

What does a negative margin do?

A

Reduces space between adjacent sibling elements, potentially causing overlap.

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

How does margin collapse work?

A

The largest margin value of two adjoining block elements is used.

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

How can margin collapse be prevented?

A

Use absolute positioning, float, or flex items with margins inside a flexbox.

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

What does the padding property do?

A

Creates space inside an element’s box, like insulation.

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

What are the four padding shorthand properties?

A

padding-top, padding-right, padding-bottom, padding-left

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

How does position: relative affect an element?

A

It maintains its place in the document flow while allowing adjustments.

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

How does position: absolute affect an element?

A

It is positioned based on its closest relatively positioned ancestor.

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

How does position: fixed affect an element?

A

It is positioned relative to the viewport and does not move when scrolling.

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

How does position: sticky affect an element?

A

It behaves like relative until it reaches a threshold, then sticks.

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

What property is used in Grid and Flexbox to create space between elements?

A

gap

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

What are the two gap shorthand properties?

A

row-gap, column-gap

17
Q

How can consistent spacing be maintained across a UI?

A

Using CSS variables like –gutter and –spacing.