Reading Time: 0 minutes, 35 secs

Margins and Paddings

Margin and padding are the two most commonly used properties for spacing-out elements. A margin is the space outside something, whereas padding is the space inside something.

Margins, padding and borders are all part of what’s known as the Box Model. The Box Model works like this: in the middle you have the content area (let’s say an image), surrounding that you have the padding, surrounding that you have the border and surrounding that you have the margin. It can be visually represented like this:

Padding
Here’s a real example when you need to set padding to a text widget when creating a button:

button2

Margin
Here’s a real example when you need to set margin:
margin

4 Was the article helpful?