Except for one important difference,CSS margins are nearly identicle to the CSS
margin attribute :
a margin
defines the white space around an HTML element's border, while
margin refers to the white space within the border.
Setting the
actual value of margin is just the same as with margin, so you
can probably zip right through this lesson.
A D V E R T I S E M E N T
margin Parameters
margin-top
To set the spacing at the top of an element,margin-top is used.
.
You can have negative values (e.g. - 2px), however, please be careful using this one, because if you specify a high negative value (or rather really low) you can cause the visitors browser to crash.
CSS Code
P {margin-top: 15px;}
margin-right
To set the spacing to the right of an element,margin-right is used.
You can have negative values (e.g. - 2px), however, please be careful using this one, because if you specify a high negative value (or rather really low) you can cause the visitors browser to crash.
CSS Code
P {margin-right: 15px;}
margin-bottom
To set the spacing at the bottom of an element,margin-bottom is used.
You can have negative values (e.g. - 2px), however, please be careful using this one, because if you specify a high negative value (or rather really low) you can cause the visitors browser to crash.
P {margin-bottom: 30px;}
margin-left
To set the spacing to the left of an element,margin-left is used.
You can have negative values (e.g. - 2px), however, please be careful using this one, because if you specify a high negative value (or rather really low) you can cause the visitors browser to crash.
CSS Code
P {margin-left: 15px;}
margin
To set the general spacing that will be used on all sides of an element,margin is used.
You can have negative values (-2px), however, please be careful using this one, because if you specify a high negative value (or rather really low) you can cause the visitors browser to crash.