Q&A Categories

Difference between Margin and Padding

Sep

22

2011

In: Software Asked By: daniel [554 Orange Star Level]
Answer #1

Most people are unable to differentiate between padding and margin. Are there any differences between CSS margin and CSS padding? Do they have some similarities? Well, the two are totally opposite. To help you differentiate between the two, padding is inside the element control whereas margin is outside the element control. Read on and learn more differences between these two puzzling terms.

Padding

In most cases padding is applied when you want to create spaces within the element of control and the boundary of element control. The content within a control could either be text or child control. Padding is used to create additional space towards the inner area within the control.

Margin

In contrast, margin is applied to help distance the boundaries within the element control. It shields all other controls that are outside it. It also defines the spaces between the boundary and other outside elements.

In other words, you need margins to place the contents inside a div or html tag. Nonetheless, when you want to place div tags as a whole, then you have to use padding. This is a winded description that will hopefully correct the differences between margins and HTML padding.

Typically, margins are the spaces around a specific element and inner space of an element. On the other hand, padding is the inner space whereas Margin is the space on the outside.

During web design, you should ensure you use correct layout so that all page elements are placed in the appropriate order and position. Sometimes, you have to add div margins or div padding to keep div tags in their correct positions.

Summary:

1. Margin is described as the space on the outside while padding is the inner space of an element.

2. They are both used in web design to help you use proper layout so that all page elements are placed in the appropriate order or position.

Answers Answered By: admin [22 Grey Star Level]
Share

Answer this Question

You must be Logged In to post an Answer.

Not a member yet? Sign Up Now »


Become our fan

Star Points Scale

Earn points for Asking and Answering Questions!

Grey Sta Levelr [1 - 25 Grey Star Level]
Green Star Level [26 - 50 Green Star Level]
Blue Star Level [51 - 500 Blue Star Level]
Orange Star Level [501 - 5000 Orange Star Level]
Red Star Level [5001 - 25000 Red Star Level]
Black Star Level [25001+ Black Star Level]