margin-bottom
sets the width of the bottom margin for an element.
Negative values are permitted.
Item | Value |
---|---|
Initial value | 0 |
Inherited | No. |
Version | CSS1 |
JavaScript syntax | object.style.marginBottom="10px" |
Applies to | All elements. |
margin-bottom: length | percentage | auto | inherit
The property values are listed in the following table.
Value | Description |
---|---|
auto | Default value. The browser does the calculation. |
length | Set width in px, cm, etc. |
% | Set width in percent of the containing element |
inherit | Inherit the width property from the parent element |
margin-bottom |
Yes | Yes | Yes | Yes | Yes |
An example showing how to use margin-bottom CSS property.
<!DOCTYPE HTML>
<html>
<head>
<style rel='stylesheet' type='text/css'>
<!--from www .j av a 2s. co m-->
div {
width: 100px;
height: 100px;
background: mistyrose;
border: 1px solid pink;
}
div#topbottom-rightleft {
margin-top: 15px;
margin-right: 5px;
margin-bottom: 15px;
margin-left: 5px;
}
</style>
</head>
<body>
<div id='topbottom-rightleft'></div>
</body>
</html>