ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

10-CSS Margin Properties

The CSS margin properties are used to generate space around elements kn a given webpage according to the users needs.

 

Margin – Individual Sides

Different marginsĀ  provided in webpage are

  • margin-top
  • margin-right
  • margin-bottom
  • margin-left

 

Example:

 

  1. <!DOCTYPE html>
  2. p {
  3.     background-color: brown;
  4. }
  5.  
  6. p.example {
  7.     border:1px solid yellow;
  8.     margin-top: 100px;
  9.     margin-bottom: 100px;
  10.     margin-right: 150px;
  11.     margin-left: 80px;
  12. }
  13. </head>
  14.  
  15. <h2>different margin properties</h2>
  16.  
  17. <p>This is a paragraph which has not been provided any  specified margins.</p>
  18. <p class="example">This paragraph uses  top and bottom margin of 100px, a left margin of 80px, and a right margin of 150px.</p>
  19.  
  20. </body>
  21. </html>
Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!