A la xarxa

imagen 8 Sin titulo-1985.jpg farreras.jpg ravetllat.jpg darder.jpg
foto 4.jpg GALLEDA  (7).jpg

The margin property sets or returns the margins of an element.

This property can take from one to four values:

  • One value, like: div {margin: 50px} - all four margins will be 50px
  • Two values, like: div {margin: 50px 10px} - the top and bottom margins will be 50px, left and right margins will be 10px
  • Three values, like: div {margin: 50px 10px 20px}- the top margin will be 50px, left and right margin will be 10px, bottom margin will be 20px
  • Four values, like: div {margin: 50px 10px 20px 30px} - the top margin will be 50px, right margin will be 10px, bottom margin will be 20px, left margin will be 30px

Both the margin property and the padding property insert space around an element. However, the difference is that margin inserts the space around the border, while padding inserts the space within the border of an element.