Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS padding-top property


May 06, 2021 CSS Reference Manual


Table of contents


CSS padding-top property


Set the top fill of a P element:

p
{
padding-top:2cm;
}

Try it out . . .

Description of property definition and use

The padding-top property sets the top padding (blank) of an element.

Note: Negative values are not allowed.

Default: 0
Inherited: no
Version: CSS1
JavaScript syntax: object .style.paddingTop="2cm"


Browser support

The numbers in the table support the first browser version number of the property.

Attributes
padding-bottom 1.0 4.0 1.0 1.0 3.5

The property value

Value Describe
length Specifies fixed top and inner margin values in specific units, such as pixels, centimeters, etc. The default is 0px.
% Defines the inner margin based on the percentage of the width of the parent element. This value does not work in all browsers as expected.
inherit Specifies that the top margin should be inherited from the parent element.


Related articles

CSS tutorial: CSS Padding