- CSS margin-bottom Property
- Browser Support
- CSS Syntax
- Property Values
- Margin Collapse
- Example
- More Examples
- Example
- Example
- CSS Margins
- CSS Margins
- Margin — Individual Sides
- Example
- Margin — Shorthand Property
- Example
- Example
- Example
- Example
- The auto Value
- Example
- The inherit Value
- Example
- All CSS Margin Properties
- margin-bottom
- Синтаксис
- Значения
- Объектная модель
- Браузеры
- margin-bottom¶
- Демо¶
- Синтаксис¶
- Значения¶
- Спецификации¶
- Описание и примеры¶
CSS margin-bottom Property
The margin-bottom property sets the bottom margin of an element.
Note: Negative values are allowed.
Default value: | 0 |
---|---|
Inherited: | no |
Animatable: | yes, see individual properties. Read about animatable Try it |
Version: | CSS1 |
JavaScript syntax: | object.style.marginBottom=»100px» Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
CSS Syntax
Property Values
Value | Description | Demo |
---|---|---|
length | Specifies a fixed bottom margin in px, cm, em, etc. Default value is 0. Negative values are allowed. Read about length units | Demo ❯ |
% | Specifies a bottom margin in percent of the width of the containing element | Demo ❯ |
auto | The browser calculates a bottom margin | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Margin Collapse
Top and bottom margins of elements are sometimes collapsed into a single margin that is equal to the largest of the two margins.
This does not happen on horizontal (left and right) margins! Only vertical (top and bottom) margins!
Look at the following example:
Example
In the example above, the