CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES

CSS margin-bottom Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The margin-bottom CSS property sets the bottom margin of the element. However in many cases the shorthand property margin is more convenient to use and preferable.

The following table summarizes the usages context and the version history of this property.

Default value: 0
Applies to:
All elements except those with table display types other than table-
caption, table, and inline-table. It also applies to ::first-letter.
Inherited: No
Animatable: Yes. See animatable properties.
Version: CSS 1, 2, 3

Syntax

The syntax of the property is given with:

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

The example below shows the margin-bottom property in action.

h1 {
    margin-bottom: 25px;
}
p {
    margin-bottom: 50px;
}

Property Values

The following table describes the values of this property.

Value Description
length A length value in px, pt, cm, em, etc. Negative values are allowed.
percentage The margin in percentage. The percentage is calculated with respect to the width of the element's containing block.
auto The browser will calculate the margin for the specified element.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element margin-bottom property.

Browser Compatibility

The margin-bottom property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 3+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: CSS Margin, CSS Box Model.

Related properties: margin, margin-left, margin-right, margin-top.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties