CSS Margins are nearly identical to the CSS Padding attribute except for one important difference: a margin defines the white space around an HTML element's border, while padding refers to the white space within the border. Setting the actual value of margin is just the same as with padding, so you can probably zip right through this lesson.
Please see the example below for a visual representation. Note: A border has been added to each element so that you may see the effects of the margin attribute.
p {margin: 5px; border: 1px solid black; } h5{margin: 0px; border: 1px solid red;}
This is a paragraph that has a margin of 5 pixels on every side: top, right, bottom, and left.
This header has no margin. It is only spaced away from the paragraph because the paragraph has a margin of 5 pixels!