CSS margin property

Description

It is a shorthand property that represents margin area around the border box.

Syntax

margin : margin-top    margin-right    margin-bottom    margin-left

Property values

0 lengthDefault

There is no thickness of the margin area.

margin: 0;

+ve length

There is 20px space around the box.

margin: 20px;

-ve length

The space around the box decreases by 20px i.e. the content below this box may merge into this box.

margin: -20px;

Applicable to

It applies to all elements

#CSS digger
Was this article helpful?

 
It is a block-level element.
This text flows below the block-level box.
×

Ctrl+D