CSS margin-bottom property
CSS Margin-bottom Property
Description
The margin-bottom property sets the width of the bottom margin of an element.
Possible Values
- length − Any length value.
-
percentage − The width of the margin is calculated relative to the width of the element’s containing block.
-
auto − The default value allows the browser to automatically set margins.
Applies to
All HTML elements.
DOM syntax
object.style.marginBottom = "5px"
Example
This is an example –
<html>
<head>
</head>
<body>
<p style = "margin-bottom: 15px; border:1px solid black;">
This is a paragraph with a specified bottom margin
</p>
<p style = "margin-bottom: 5%; border:1px solid black;">
This is another paragraph with a specified bottom margin in percent
</p>
</body>
</html>
This will produce the following result −