CSS margin-top property
Description of property definition and use
The margin-top property sets the upper margin of the element.
Note: Negative values are allowed.
Default: | 0 |
---|---|
Inherited: | no |
Version: | CSS1 |
JavaScript syntax: | object .style.marginTop="10px" |
Browser support
The numbers in the table support the first browser version number of the property.
Attributes | |||||
---|---|---|---|---|---|
margin-top | 1.0 | 6.0 | 1.0 | 1.0 | 3.5 |
The property value
Value | Describe |
---|---|
auto | The top margin of the browser settings. |
length | Define a fixed top-out margin. The default is 0. |
% | Defines the outer margin based on the percentage of the total height of the parent object. |
inherit | Specifies that the top margin should be inherited from the parent element. |
Related articles
CSS tutorial: CSS Margin