CSS margin-top Property Tutorial

In this section, we will learn what the margin-top property is and how to use it in CSS.

CSS margin-top Property Definition and Usage

The CSS `margin-top` property is used to set the top margin of an element in an HTML document.

CSS margin-top Property Syntax

margin-top: length|auto|initial|inherit;

CSS margin-top Property Value

The value of this property is a number with relative, or absolute units supported in CSS.

Note: you could also use the two global values “initial” and “inherit” for this property.

Example: margin-top in CSS

See the Pen margin-top in CSS by Enjoy Tutorials (@enjoytutorials) on CodePen.


Top Technologies