padding
Description »Padding is the shorthand property for defining the distance between the selected element and the elements inside of it. |
|
Possible Values »
- padding: top right bottom left;
- Sets the padding for each side individually.
- padding: top-bottom right-left;
- Two values can be passed instead of four. The first sets the top and bottom; the second sets the right and left.
- padding: top right-left bottom;
- If three values are passed, the first sets the top padding, the second sets the right and left, and the last sets the bottom.
- padding: all;
- A single value will set the padding of all four sides of the selected element.
- padding: inherit;
- The element inherits the padding settings of the parent element.
Details »
Padding adjusts the spacing inside of the element. If I had a div block with text in it, the padding would determine how far away that text is from the borders of the div.
Padding values can be measured by pixels (px), em, or percentage (%). Note that you cannot have a negative padding.
This property is used to define the padding for each side of an element. You can access individual sides as well:
In Practice »
Results | CSS |
Try it! | at The CSS Zone Sandbox |