Brian's Blog

items I see across my tribes

CSS–Margin vs Padding

February 10
by briancarter 10. February 2011 10:48

CSS provides two properties named margin and padding for keeping space  between HTML Box type elements. But why do we have two properties for the same reason?
Are they similar?

No. They have a main difference.
Padding - defines space between border and element content
Margin - defines space between border and other outer elements

Something I ran into on an existing project that required fixing.

Categories:


 Questions or Feedback, my contact information is located on my About page.


The opinions, thoughts, and comments made in these blog posts are solely my own (unless otherwise stated). They do not reflect the opinions, thoughts or practices of my employer, my universities, my family, or anyone else. Also, I retain the right to change my mind about anything I publish here without having to go back and edit posts that occurred in the past. 

These are my opinions, or just as likely, someone else's opinions that I leveraged for my own.