CSS Margin

Last Updated: March 27, 2022

margin is CSS shorthand property and it sets the margin around an element.

CSS Margin Syntax

margin: top right bottom left

margin: 5px 10px 5px 10px 5px

You can define the margin property in the following ways

margin: 5px; 
margin: 2px 4px;
margin: 2px 4px 2px;
margin: 2px 4px 2px 4px;

Test