Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS margin-bottom property

CSS margin-bottom property

Example

Set the bottom margin of a p element:

p

{

margin-bottom:2cm;

}

Try it »


Property definition and usage

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

Note: Negative values are allowed.

Default value: 0
Inherited: no
Version: CSS1
JavaScript syntax: object.style.marginBottom="10px"

Browser support

The numbers in the table indicate the first browser version that supports this property.

property
margin-bottom 1.0 6.0 1.0 1.0 3.5

Attribute values

Value Description
auto The browser calculates the bottom margin.
length Specifies the bottom margin in a specific unit, such as pixels, centimeters, etc. The default value is 0px.
% Specifies the bottom margin as a percentage of the parent element's width.
inherit Specifies that the bottom margin should be inherited from the parent element.

Related Articles

CSS Tutorial: CSS Margin