The browse engine represents content into a rectangular box.CSS defines some content area of this element, we can asinine some padding , margin and border to it. The CSS box model looks like this.
Padding:
Padding takes place around the content. To apply padding we have different properties.
- padding-top:10px;
- padding-bottom:10px;
- padding-right:10px;
- padding-left:10px;
And we also have a shortcut to apply padding.
- padding:10px 10px 10px 10px; //top right bottom left.
- padding:20px 40px; //top-bottom left-right.
Border:
Borer resides in a box model after padding. We can also control the width,height and color of the border. border:4px solid black;
Margine:
Margine take place in the CSS Box Model after border. We have margin property to apply margin.
margin-top:10px; margin-bottom:10px; margin-left:10px; margin-right:10px;
And we also have a shortcut for margin.
margin:10px 20px 10px 40px; // top right bottom left, it works in clockwise direction.