CSS padding property | css padding
ExampleSetthepaddingforallfoursidesofa
elementto35pixels:p{ padding:35px;}TryitYourself»[1]More"TryitYourself"examplesbelow.DefinitionandUsageAnelementspaddingisthespacebetweenitscontentanditsborder.Thepaddingpropertyisashorthandpropertyfor:Note:Paddingcreatesextraspacewithinanelement,whilemargincreatesextraspacearoundanelement.Thispropertycanhavefromonetofourvalues.Ifthepaddingpropertyhasfourvalues:padding:10px5px15px20px;toppaddingis10pxrightpaddingis5pxbottompaddingis15pxleftpadd...
ExampleSet the padding for all four sides of a <p> element to 35 pixels:
p { padding: 35px;}
Try it Yourself »[1]More "Try it Yourself" examples below.
Definition and UsageAn elements padding is the space between its content and its border.
The padding property is a shorthand property for:
Note: Padding creates extra space within an element, while margin creates extra space around an element.
This property can have from one to four values.
If the padding property has four values:
padding:10px 5px 15px 20px; top padding is 10px right padding is 5px bottom padding is 15px left padding is 20pxIf the padding property has three values:
padding:10px 5px 15px;top padding is 10px right and left padding are 5px bottom padding is 15pxIf the padding property has two values:
padding:10px 5px;top and bottom padding are 10px right and left padding are 5pxIf the padding proper...