css.properties

margin-top

The margin-top property sets the top margin of an element.

Formal Syntax

margin-top = <length-percentage> | auto | <anchor-size()> <length-percentage> = [ <length> | <percentage> ]

See specification

JavaScript Access

// Access via element.style element.style.marginTop = 0;

Logical Property Group

This property belongs to the margin logical property group, which includes:

Browser Support

standard | MDN ยท Spec

FeatureChromeFirefoxSafariEdge
margin-top11112
anchor-size13214726132
auto11112

Related Properties