| Syntax | selector {margin: width width width width;}
(OR)
selector {margin: value;}
|
|---|---|
| Usage | The margin property is used as a shorthand method to specify all 4 margin widths in one place. See the Box Model for a description of the boxes that are generated for elements and the relative position of the margins. If a percentage value is used, the value will be a percentage of the containing block's width.
|
| Keywords |
|
| Applies To | All elements except elements with the following display types: table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell. |
| Inherited | No |
| Initial Value | 0 for each of the four individual margin sides. |
![]() ![]() The margin property is set using a single value.![]() ![]() The margin property is set using 2 values.![]() ![]() The margin property is set using 3 values.![]() ![]() The margin property is set using 4 values. |