English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS reference manual

CSS @rules

CSS attributes大全

CSS margin-Usage and examples of bottom property

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

The following table provides usage instructions and version history of this property, as well as its usage syntax in JavaScript scripts.

Default value:0
Applies to:All elements, but not table displayelements of types other than table-caption table inline-table. It also applies to ::first-letter.
Inheritance:No
Animatable:Yes.Please refer to Animation properties.
Version:CSS 1,2,3
JavaScript syntax:object.style.marginBottom="20px"

margin-Syntax of bottom usage

The syntax of this property is as follows:

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

The following examples demonstrate how to use margin-bottom property.

  h1 {
   margin-bottom: 25px;
  }
  p {
   margin-bottom: 50px;
  }
Test and see‹/›

Property value

The following table describes the value of this property.

ValueDescription
lengthSpecify the bottom outer margin value with specific units, such as px, pt, cm, em, etc., which can be negative.
percentageSpecify the bottom outer margin based on a percentage of the parent element's width.
autoThe browser will calculate the margin of the specified element.
initialSet this property to its default value.
inheritIf specified, the associated elements will use the margin of their parent element-The value of the bottom property.

Browser compatibility

margin-Browser compatibility of the bottom property, the numbers in the table below represent the minimum version number of browsers that support this property; all mainstream browsers support this property.

  • Firefox 1+

  • Google Chrome1+

  • Internet Explorer 3+

  • Apple Safari 1+

  • Opera 4+

Read more

Please refer to the following tutorials:CSS Margin,CSS Box Model.

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