margin
property
Sets the margin area on all four sides of an element. Accepts length, percentage, or auto.
Syntax
margin: top right bottom left;
Example
css
.box {
margin: 20px; /* all sides */
margin: 10px 20px; /* top-bottom left-right */
margin: 10px 20px 30px; /* top left-right bottom */
margin: 5px 10px 15px 20px; /* top right bottom left */
}
/* Center horizontally */
.centered {
width: 800px;
margin: 0 auto;
}
/* Negative margins */
.overlap {
margin-top: -20px;
}