Padding v margin?
As I understand it, the basic difference between padding and margin is that margin is adding space around an element and padding is adding space within an element.
I don't understand how the difference works for things such as p and h1 with pure text (no borders, decoration, etc.). When I compare, for example, "margin: 1em" to "padding: 1em" in a p or h1 definition, the padding takes up a bit more space. Why is this?
I've looked at a few tutorials, which usually have some variation of what I wrote in the first paragraph and apply padding v margin to things which have borders, in which case the around v. within difference makes more sense.
Why the difference I'm seeing for normal text? As is often the case, I feel I'm missing something simple.
|