CSS padding-right property

Definition and Usage

The padding-right property sets the right inner padding (whitespace) of the element.

Note:Negative values are not allowed.

Description

This property sets the width of the right inner padding of the element. The right inner padding set on inline non-replaced elements only appears on the right side of the first inline box generated by the element.

See Also:

CSS Tutorial:CSS inner padding

HTML DOM Reference Manual:paddingRight Property

Example

Set the right inner padding of the p element:

p
  {
  padding-right:2cm;
  }

Try It Yourself

(More examples can be found at the bottom of the page)

CSS Syntax

padding-right: length|initial|inherit;

Property Value

Value Description
length Specifies a fixed right inner padding value in specific units, such as pixels, centimeters, etc. The default value is 0px.
% Defines a percentage right inner padding based on the width of the parent element. This value may not work as expected in all browsers.
inherit Specifies that the right inner padding should be inherited from the parent element.

Technical Details

Default Value: 0
Inheritance: no
Version: CSS1
JavaScript Syntax: object.style.paddingRight="10px"

Try It Yourself Example

Set right inner padding 1
This example demonstrates how to set the right inner padding of a cell using centimeter values.
Set right inner padding 2
This example demonstrates how to set the right inner padding of a cell using percentage values.

Browser support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome IE / Edge Firefox Safari Opera
1.0 4.0 1.0 1.0 3.5