padding - CSS | css padding
ThepaddingCSS[1]shorthandproperty[2]setsthepaddingarea[3]onallfoursidesofanelementatonce.Anelementspaddingareaisthespacebetweenitscontentanditsborder.Note:Paddingcreatesextraspacewithinanelement.Incontrast,margin[4]createsextraspacearoundanelement.ThispropertyisashorthandforthefollowingCSSproperties:padding:1em;padding:5%10%;padding:1em2em2em;padding:5px1em02em;padding:inherit;padding:initial;padding:revert;padding:revert-layer;padding:unset;Thepaddingpropertymaybespecifiedusingone,two,three...
The padding CSS[1] shorthand property[2] sets the padding area[3] on all four sides of an element at once.
An elements padding area is the space between its content and its border.
Note: Padding creates extra space within an element. In contrast, margin[4] creates extra space around an element.
This property is a shorthand for the following CSS properties:
padding: 1em; padding: 5% 10%; padding: 1em 2em 2em; padding: 5px 1em 0 2em; padding: inherit; padding: initial; padding: revert; padding: revert-layer; padding: unset;The padding property may be specified using one, two, three, or four values. Each value is a <length>[5] or a <percentage>[6]. Negative values are invalid.
When one value is specified, it applies the same padding to all four sides. When two values are specified, the first padding applies to the top and bottom, the second to the left and right. When three values are specified, the first padding applies to ...