Question
When should I use padding
vs margin
?
Answer
We should use padding
when we want to give an element more space between its content and its border - example: adding padding
on a paragraph element when we don’t want the paragraph text to touch the border of the paragraph element.
We should use margin
to give space between elements - example: we have two <img>
elements next to each other but we don’t want them touching.