is used to create space around an element’s content, inside of any defined borders
CSS Padding
CSS has properties for specifying the padding for each side of an element
padding-top
padding-right
padding-bottom
padding-left
div {
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
}All the padding properties can have the following values
length - specifies a padding in px, pt, cm, etc.
% - specifies a padding in % of the width of the containing element
inherit - specifies that the padding should be inherited from the parent element
Negative values are not allowed
If the padding property has four values the shorthand would be
padding: 25px 50px 75px 100px;
top padding is 25px
right padding is 50px
bottom padding is 75px
left padding is 100px
This causes the element to maintain its actual width; if you increase the padding, the available content space will decrease
box-sizing
div {
width: 300px;
padding: 25px;
box-sizing: border-box;
}