What is the difference between padding and margins?

Margins and padding can be confusing to the web designer. After all, in some ways, they seem like the same thing white space around an image or object.

Padding is the space inside the border between the border and the actual image or cell contents. In the image, the padding is the yellow area around the contents. Note that padding goes completely around the contents: there is padding on the top, bottom, right and left sides.

Margins are the spaces outside the border, between the border and the other elements next to this object. In the image, the margin is the red area outside the entire object. Note that, like the padding, the margin goes completely around the contents: there are margins on the top, bottom, right, and left sides.

Permanent link to this article: https://blog.openshell.in/2011/04/what-is-the-difference-between-padding-and-margins/

Leave a Reply

Your email address will not be published.