10-CSS Margin Properties

0
48

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. p {<br />
  2.     background-color: brown;<br />
  3. }</p>
  4. <p>p.example {<br />
  5.     border:1px solid yellow;<br />
  6.     margin-top: 100px;<br />
  7.     margin-bottom: 100px;<br />
  8.     margin-right: 150px;<br />
  9.     margin-left: 80px;<br />
  10. }<br />
  11.  
  12. &nbsp;
  13. <h2>different margin properties</h2>
  14. This is a paragraph which has not been provided any specified margins.
  15. <p class="example">This paragraph uses top and bottom margin of 100px, a left margin of 80px, and a right margin of 150px.</p>
  16. &nbsp;
Facebook Comments
SHARE
Previous article09-CSS List Properties
Next article11-CSS Padding Properties

Hello Itsourcecoders, welcome to itsourcecode.com. I’m Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I’ve learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!

LEAVE A REPLY

Please enter your comment!
Please enter your name here