Easy Tutorial
❮ Pr Grid Column End Pr Font Font Style ❯

CSS padding Property

Example

Set the padding for a P element:


Property Definition and Usage

The padding shorthand property sets all padding properties in one declaration. This property can have from one to four values.

Examples:

Note: Negative values are not allowed.

Default value: 0
Inherited: no
--- ---
Version: CSS1
--- ---
JavaScript syntax: object.style.padding="10px 5px"
--- ---

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
padding 1.0 4.0 1.0 1.0 3.5

Property Values

Value Description
length Specifies a padding in absolute units, such as pixels, centimeters, etc. Default value is 0px
% Specifies a padding in percentage relative to the width of the containing element
inherit Specifies that the padding should be inherited from the parent element

Related Articles

CSS Tutorial: CSS Padding

❮ Pr Grid Column End Pr Font Font Style ❯