Definition The margin-top property sets the top margin of an element. Note: Negative values are allowed. Inherited: No JavaScript Sy...
Definition
The margin-top property sets the top margin of an element.Note: Negative values are allowed.
Inherited: No
JavaScript Syntax
CSS properties can also be dynamically changed with a JavaScript.Scripting Syntax: object.style.marginTop="10px"
Example
h1 { margin-top: 10px } h2 { margin-top: -20px } |
Possible Values
Value | Description |
---|---|
auto | The browser sets a top margin |
length | Defines a fixed top margin. Default value is 0 |
% | Defines a top margin in % of the total height of the document |
Goto CSS3 and CSS2 complete reference