View Single Post
Old 03-05-2004, 04:24 AM   #2
TadW
Uebermensch
TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.TadW ought to be getting tired of karma fortunes by now.
 
TadW's Avatar
 
Posts: 2,583
Karma: 1094606
Join Date: Jul 2003
Location: Italy
Device: Kindle
Quote:
Originally Posted by Francesco
Could someone please explain me the difference between margin and padding?
Padding:
If your element has a background color that background color would fill the content area and the padding area. i.e. it would be inside the "element". So padding separates the content from the border, like the packing material in a box.

Margin:
If you want to space an element from it's preceding element then margin would be the correct thing to use as it does just that: creates a margin between one element and the next. So margin is on the very outside, on the edge if you like.

If it helps to do it visually, think of an A4 page of type inside a picture frame.
The margin is the space between the edge of the sheet of paper and the other elements (the parts of the frame).

The padding is the space between the edge of the sheet and where the type starts on the page.

The border would be the edge of the sheet of paper.

Also see attached picture

Tad
Attached Thumbnails
Click image for larger version

Name:	marginpadding.gif
Views:	708
Size:	7.7 KB
ID:	284  
TadW is offline