CSS margin-bottom Property

CSS margin-bottom property sets the margin of the bottom of an element. It can be specified in any valid CSS length formats such as ‘px’, ’em’, ‘rem’ or even in percentage(%).

It can have a positive, negative or zero value.


  margin-bottom: 100px;

It is also possible to set a negative margin. In such a scenario, the element pulls the neighboring elements towards it and the content starts overlapping. See the example below:


  margin-bottom: -40px;

CSS Syntax

The margin-bottom property has the following syntax:

margin-bottom: length|percentage|auto|initial|inherit;

Property Values

The margin-bottom property accepts the following values:

lengthSets a fixed bottom margin in CSS length formats such as ‘px’, ’em’, ‘rem’, etc. It can be positive, negative or zero. The default value is zero(0).
percentageSets bottom margin in percentage. The percentage value is calculated by taking the percentage of the element’s width itself.
autoThe browser itself calculates the margin value.
initialSets the margin-bottom property to its default value(0).
inheritInherits the margin-bottom property from the parent element.

General Info

Default Value0
JavaScript Usageelement.style.marginBottom = “100px”;