Menu
The margin-top
property designates the top margin of an element.
Both positive and negative values are allowed.
div.ex {
margin-top: 20px;
}
length
Designates in length units (px, pt, em, etc.) a fixed top margin of the element. Default value is 0.
%
Designates a top margin in percentage of the width of the containing element.
auto
The top margin is calculated by the browser.
initial
Sets the property to its default value.
inherit
Inherits this property’s value from its parent item.
Have a code example of margin-top
? Submit a codepen.io demo and we'll showcase it here ↴