Put a border in there and things should clarify by them self: margin has to do with the neighbours of an element (in relation with the outside), padding has to do with the content of an element (in relation with the inside).
it’s also VERY IMPORTANT to note that padding and borders don’t interact with each other. It not something you would foresee in Joon’s code, above. but if you had to elements lets say P like this and p {margin: 0; padding:15px; border:none }
<p>text</p>
<p>more text</p>
the distance between the text would be: 30px ( 15px of padding bottom from the first P and 15px of padding top from the second P)
however if the CSS was {margin: 15px; padding:0; border:none }
the distance would be 15px!!! that is margin collapse… it unexpected at first , but I have found it can be harnessed and quite useful.
BUT WAIT THERE IS MORE!
If the CSS is {margin: 15px; padding:1px; border:none } or {margin: 15px; padding:0; border:1px solid pink }
the distance is now 32px!?!?! Yes, even tho the margin is outside the the border and/or padding interferes with its collapse so you sum all the attributes up to get the distance:
margin top+ margin bottom + Border top+ border bottom+ padding top+padding bottom,
remembering of course that the margin distance will always be transparent , the padding will take on the background color of the element and the border can have its own color, or be transparent ( but when the border IS TRANSPARENT… it will show the Background color of the element through)
another thing is: you can have NEGATIVE margins p{margin:-5px} which would move things towards each other rather than away… but there is no such thing as negative padding…
Also while padding and margins can use px, em or %, borders only take px or ems
other than the proverbial BOX MODEL… which is of little concern if you aren’t developing for IE previous to 6, AND use STRICT DOC TYPES…