Explore 100's Of Free Video Tutorials

Keep Learning, Keep Coding & Keep Sharing

CSS

CSS margin properties

Notes:

CSS Margin Area Properties

CSS margin-top property:
It is used to specify the amount of area to be cleared above an html element
Values: auto | length | %

CSS margin-right property:
It is used to specify the amount of area to be cleared on the right hand side an html element
Values: auto | length | %

CSS margin-bottom property:
It is used to specify the amount of area to be cleared below an html element
Values: auto | length | %

CSS margin-left property:
It is used to specify the amount of area to be cleared on the left hand side an html element
Values: auto | length | %

CSS margin short hand property:
It is used to specify the amount of area to be cleared around an html element
Values: Space separated list of values (1, 2, 3, and 4)

Ex:
margin: 10px;
indicates: margin-top:10px; margin-right:10px; margin-bottom:10px; margin-left:10px;

Ex:
margin: 10px 20px;
indicates: margin-top:10px; margin-bottom:10px; margin-right:20px; margin-left:20px;

Ex:
margin: 10px 20px 10px ;
indicates: margin-top:10px; margin-right:20px; margin-left:20px; margin-bottom:10px;

Ex:
margin: 10px 10px 10px 10px ;
indicates: margin-top:10px; margin-right:10px; margin-bottom:10px; margin-left:10px;

Interview Questions: