DEV Community

sutharrahul
sutharrahul

Posted on

CSS Box Model

Margin :

Margin are use to create space around element form all four border.
Example
margin: 10px 12px 15px 20px it cerate space 10px form top 12px from right 15px from bottom and 20px from left. if we just want create space only one side could be top or bottom or right or left we can simply use these property.

margin-top: ;
margin-right: ;
margin-bottom: ;
margin-left: ;
Enter fullscreen mode Exit fullscreen mode

Padding:

Padding are use to create space around element content but inside of boarder. we can create space to top , bottom, right and left.
padding: 10px 12px 15px 20px

padding-top: ;
padding-right: ;
padding-bottom: ;
padding-left: ;
Enter fullscreen mode Exit fullscreen mode

Image description

Top comments (0)