CSS margin-bottom property
- previous page margin-block-start
- Next Page margin-inline
Definition and Usage
The marginBottom property sets the bottom outer margin of the element.
Note:Negative values are allowed.
See Also:
CSS Tutorial:CSS Margin
HTML DOM Reference Manual:marginBottom Property
Example
Set the bottom outer margin of the p element:
p { margin-bottom:2cm; }
(More examples can be found at the bottom of the page)
CSS Syntax
margin-bottom: length|auto|initial|inherit;
Property Value
Value | Description |
---|---|
auto | The browser calculates the bottom outer margin. |
length | Specifies the bottom outer margin value in a specific unit, such as pixels, centimeters, etc. The default value is 0px. |
% | Specifies the bottom outer margin in percentages of the containing element's width. |
inherit | Specifies that the bottom outer margin should be inherited from the parent element. |
Technical Details
Default Value: | 0 |
---|---|
Inheritance: | no |
Version: | CSS1 |
JavaScript Syntax: | object.style.marginBottom="10px" |
More Examples
- Set the bottom outer margin of text to 1
- This example demonstrates how to set the bottom outer margin of text using centimeter values.
- Set the bottom outer margin of text to 2
- This example demonstrates how to set the bottom outer margin of text using percentage values.
Browser Support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | IE / Edge | Firefox | Safari | Opera |
---|---|---|---|---|
1.0 | 6.0 | 1.0 | 1.0 | 3.5 |
- previous page margin-block-start
- Next Page margin-inline