Margins

Margins

A margin is an optional amount of space, add on the out-side of the borders.

Syntax: property: value;
values: length | percentage | auto
Default: auto
Applies to: all elements
Inherits: no

margin-top

 The margin-top property specifies the top margin of an element.

Example
 p { margin-top: 2em;
 border: 2px solid red;
 background-color: sliver;
 padding: 2px;
 color: green;
 }
margin-right

 The margin-right property specifies the right margin of an element.

Example
 p { margin-right: 4em;
 border: 2px solid red;
 background-color: sliver;
 padding: 2px;
 color: green;
 }
margin-bottom


The margin-bottom property specifies the bottom margin of an element.

Example
p { margin-bottom: 2em;
 border: 2px solid red;
 background-color: sliver;
 padding: 2px;
 color: green;
 }
margin-left

 The margin-left property specifies the left margin of an element.

Example
 p { margin-left: 4em;
 border: 2px solid red;
 background-color: sliver;
 padding: 2px;
 color: green;
 }
margin

 The margin property is used to specify the all margin in one declaration.

Example
p { border: 2px solid red;
 background-color: sliver;
 padding: 2px;
 color: green;
 margin: 2em 4em 2em 4em;
 }

Leave a Reply