It seems like modifying either the padding or the margin property will change the spacing between elements. If I want to create space between elements, how do I know which property to modify?

Question

It seems like modifying either the padding or the margin property will change the spacing between elements. If I want to create space between elements, how do I know which property to modify?

Answer

This is very layout dependent but in general we want to use the margin property to change the spacing between elements and the padding property to create space within the element itself (between the content of an element and it’s border).