CSS Margin property is used to define the space around elements. It is completely transparent and doesn’t have any background color. It clears an area around the element.
Top, bottom, left and right margin can be able to changed independently using separate properties. You can also change all properties at once by using shorthand margin property.
There are following CSS margin properties:
|margin||It is used to set all the properties in one declaration.|
|margin-left||This property is used to set left margin of an element.|
|margin-right||This property is used to set right margin of an element.|
|margin-top||This property is used to set top margin of an element.|
|margin-bottom||This property is used to set bottom margin of an element.|
CSS Margin Values:
|auto||This is used to let the browser calculate a margin.|
|length||It is used to specify a margin cm,px,pt etc. its default value is 0px.|
|%||It is used to dispay a margin in percent of the width of containing element.|
|inherit||It is used to inherit margin from parent element.|