CSS margin-bottom Property
The CSS margin-bottom property specifies how much margin should be used at the bottom of an element. The margin can be specified as a length or as a percentage.
Syntax
margin-bottom: length | auto | initial | inherit;
Example
x
<html>
<head>
<style>
.ex1 {
margin-bottom: 40px;
}
</style>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p class="ex1">Fusce nec nibh sed risus faucibus sagittis sed venenatis sem.</p>
<p>In sed enim a erat fermentum elementum.</p>
</body>
</html>
Property Values
Value | Description |
---|---|
length | Specifies a fixed bottom margin in px, cm, em, and other units. The default value is zero. Negative values are permitted. Learn more about length units. |
% | Sets the bottom margin as a percentage of the width of the containing element. |
auto | The bottom margin is calculated by the browser. |
initial | This property is set to its default value. |
inherit | This property is inherited from its parent element. |
Supported Browsers
Property | Chrome | Firefox | Safari | Edge / IE | Opera |
---|---|---|---|---|---|
margin-bottom | 1.0 | 1.0 | 1.0 | 6.0 | 3.5 |