View Single Post
Old 09-20-2024, 01:33 PM   #1
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 479
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
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.
foosion is offline   Reply With Quote