The CSS padding property is used for creating space around the content of an element. CSS provides different properties, with the help of which you can set the padding for an element’s each side (right, left, top and bottom).
With the help of the following properties you can set the padding for each side of an element:
As you can guess, for the top, we use padding-top, for bottom padding-bottom, for left side padding-left and right padding-right.
All the padding properties can have the values below:
Take into account, that CSS padding property cannot accept negative values. Its default value for all padding properties is 0.
Note: Padding creates extra space within an element, while margin creates extra space around an element.
If the padding property has four values:
If the padding property has three values:
If the padding property has two values:
If the padding property has one value:
padding: length|initial|inherit;
Supported Browsers: The browser supported by property are listed below: