CSS Margin
The CSS margin
property is used to create space around the HTML element border. These spaces could be of type top margin, bottom margin, left margin, right margin.
Assigning Margins for Individual Sides
CSS provides margin properties for four sides of an element.
margin-top
margin-right
margin-bottom
margin-left
All the margin properties can assign the following values:
auto
- the browser automatically calculates the margin.length
- specifies a margin in px, pt, cm, etc.%
- specifies a margin in % of the width of the containing element ,means this concept works on the basis of relative concept.-
inherit
- It indicates that margin could be in inherited from the parent element.
Remember- The CSS Margin property is used to layout the HTML documents. Margin is basically a space generated outside of the HTML tag border.