property
margin — CSS reference
Shorthand for the four physical margin edges. One value fills all sides; two set vertical and horizontal; three set top, horizontal and bottom; four run clockwise from top. Initial longhands zero; not inherited. Negative lengths are valid; auto is layout-dependent. Percentages use the containing block inline size.
Formal Syntax & Structure
css syntaxcss
[ <length-percentage> | auto ]{1,4}Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS box geometry lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}#a{margin:8px 12px 16px 20px}</style><body><div id="a" class="sample">Sample</div></body></html>