CSS Margins
The Margins in CSS are creating space around the element and outside of its borders.
The margins can have numeric or percentage values (plus negative values) while they can also be specific as listed below:
- margin-top: auto | numeric | % | inherit ;
- margin-left: auto | numeric | % | inherit ;
- margin-right: auto | numeric | % | inherit ;
- margin-bottom: auto | numeric | % | inherit ;
The shorthand property:
margin: 15px 30px 45px 70px;
The above shorthand property is explained as per below:
top margin = 15px
right margin = 30px
bottom margin = 45px
left margin = 70px
Some Border examples:
Margin 40px
The output:
Margin 40px