Prelims - CSS margins Flashcards

1
Q

are used to create space around elements, outside of any defined borders

A

CSS Margins

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

CSS has properties for specifying the margin for each side of an element:

A

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

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

All the margin properties can have the following values:

A

auto - the browser calculates the margin
length - specifies a margin in px, pt, cm, etc.
% - specifies a margin in % of the width of the containing element
inherit - specifies that the margin should be inherited from the parent element

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

Use the margin shorthand property with four values:

A

top margin is 25px
right margin is 50px
bottom margin is 75px
left margin is 100px

p {
  margin: 25px 50px 75px 100px;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

You can set the margin property to ____ to horizontally center the element within its container

A

auto

div {
  width: 300px;
  margin: auto;
  border: 1px solid red;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly