When should I use padding vs margin?

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.

4 Likes

I think the question was more in which situations/context should we use padding and margin?

1 Like

thank you for the skibidi rizz tips