The margin property is used to set the space around the sides of an element's, outside of any defined borders.
Example of Code
<style>
#example-Setting-Margins-on-all-Sides-div {
border: 1px solid orange;
}
#example-Setting-Margins-on-all-Sides-div > p {
background: gold;
margin: 20px;
}
</style>
<div id="example-Setting-Margins-on-all-Sides-div">
<p>
This text has a margin of 20 pixels on all four sides. It is nested within a div with a border to make it easier to see the effect of the margin.
</p>
</div>
Output
This text has a margin of 20 pixels on all four sides. It is nested within a div with a border to make it easier to see the effect of the margin.
