0
0
CSSmarkup~5 mins

Margin in CSS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the CSS margin property?
The margin property creates space outside an element's border. It pushes other elements away, controlling the distance between elements.
Click to reveal answer
beginner
How do you set different margin sizes for top, right, bottom, and left in CSS?
Use margin-top, margin-right, margin-bottom, and margin-left properties to set each side's margin individually.
Click to reveal answer
beginner
What does margin: 10px 20px; mean?
It sets the top and bottom margins to 10 pixels, and the left and right margins to 20 pixels.
Click to reveal answer
intermediate
What happens if you set margin: auto; on a block element with a fixed width?
The element will center horizontally within its container because the left and right margins automatically adjust equally.
Click to reveal answer
intermediate
Can margin values be negative? What does that do?
Yes, margins can be negative. Negative margins pull the element closer to or even overlap with neighboring elements.
Click to reveal answer
Which CSS property controls the space outside an element's border?
Awidth
Bpadding
Cborder
Dmargin
What does margin: 5px 10px 15px 20px; set?
AAll sides 5px
BTop 20px, Right 15px, Bottom 10px, Left 5px
CTop 5px, Right 10px, Bottom 15px, Left 20px
DTop and Bottom 5px, Left and Right 10px
What effect does margin: auto; have on a block element with a fixed width?
ACenters the element horizontally
BRemoves all margins
CAdds equal margin on top and bottom only
DHas no effect
Which margin property sets the space on the left side of an element?
Amargin-left
Bmargin-right
Cmargin-top
Dmargin-bottom
What happens if you use a negative margin value?
AElement gets bigger
BElement moves closer or overlaps neighbors
CElement disappears
DMargin resets to zero
Explain how the CSS margin property affects the space around an element and how you can control each side separately.
Think about pushing elements away from each other.
You got /3 concepts.
    Describe how to center a block element horizontally using margin in CSS.
    Use auto margins to balance space on sides.
    You got /3 concepts.