CSS Margin Property

In this chapter you will learn:
About margin property
Example of this property
CSS margin property is used to specify space arround the element or tag. If you want to clear spaces of left, right, top and bottom of any element then you can use this property. It has some dependent properties like- margin-left, margin-right, margin-top and margin-bottom.
Example of this property:
<html>
<head>
    <title>Example of margin property</title>
    <style type="text/css">
    #a
    {
   margin-left:120px;
   margin-right:800px;
   margin-top:50px;
   margin-bottom:400px;
   background-color:Yellow;
    }
    </style>
    </head>
<body>
<div style="background-color:Blue"> This is the example of margin</div>
<div id="a">This is the example of margin</div>
</body>
</html>

Guide:-
When you run the given program then you will get that the division without it is displayed in normal form but the division which has id "a" is displayed according to the margin.
Output:-
example of font-size property

Summary

In this chapter, you have learned about margin property. One example is given for your better guide so try it yourself and click on Next button to continue-

More Articles

 

Share your thought



PLEASE DISABLE ADBLOCKER AND SUPPORT US!

Please support us by enabling ads on this page. Refresh

YOU DON'T LIKE ADS, WE ALSO DON'T LIKE ADS!
 
But we have to show ads on our site to keep it free and updated. We have to pay huge server costs, domain costs, CDN Costs, Developer Costs, Electricity and Internet Bill. Your little contribution will encourage us to regularly update this site.