CSS margin property indicates the space around an HTML element. We can use negative values to overlap content, means margin can be less than zero
How to define Margin in CSS
<style>
.div
{
margin-top:10px;
margin-top:5px;
margin-left:4px;
margin-right:6px;
}
</style>
Different type of margin |
margin-top |
indicates the top margin of an html element |
margin-bottom |
indicates the bottom margin of an html element |
margin-left |
indicates the left margin of an html element |
margin-right |
indicates the right margin of an html element |
Margin Auto Example
<div style="width:50%;margin: 0 auto;">
</div>