Margin and padding

March 17, 2008 |

The difference between margin and padding in css can be a bit confusing.

Margin is the space outside an element, while padding is the space inside an element. To illustrate this I have posted this image, which should explain it quite well.

margin and padding

You cannot use negative values with padding, but with margins you can.



Comments

You must be logged in to post a comment.

Name (required)

Email (required)

Website

Speak your mind