Skip to main content

CSS margin property - Clarification margin: 0 0 10px;

 In this post we will going to explain the CSS margin property  margin: 0 0 10px;

The margin CSS property sets the margin area on all four sides of an element. It is a shorthand for margin-top, margin-right, margin-bottom, and margin-left.

CSS margin short hand code can be a bit confusing at first.

margin: 0 0 10px; 

Top margin = 0 Right/Left margin = 0 Bottom margin = 10px or pixels

margin: 30px;  
//All four margins are 30px

margin: 10px 40px; 
//Top & Bottom margin = 10px, left & right = 40

margin: 10px 20px 30px;
// top=10, left/right=20, bottom=30

margin: 10px 20px 10px 20px;
 // Top=10, Right=20, Bottom=10, Left=10

 


Comments