CSS padding-right Property
Description
The padding-right property controls the inner space on the right side of an element between its content and its border. Visually it pushes content inward from the element’s right edge, which changes where text, images, or other child elements appear without altering the position of the element itself in the document flow. Because the padding area is inside the border, background painting and other interior decorations extend into that space, making padding-right a useful tool for adjusting spacing while preserving an element’s visible frame.
This property is often used together with the overall padding shorthand and the opposite edge property padding-left to create balanced interior spacing. Its effect on an element’s final box dimensions depends on the box sizing model in use; for example, the box-sizing mode changes whether padding contributes to the element’s reported width or is included inside it. When adjusting layout, consider how increasing right padding interacts with neighboring elements and available inline space so text wrapping and alignment behave as expected.
For direction-aware layouts, logical properties provide an alternative: instead of targeting the physical right edge you can use padding-inline-end, which maps to the appropriate side for left-to-right and right-to-left content. Also remember the difference between inner and outer spacing: margin sits outside the border and affects spacing between elements, while padding affects spacing inside the element’s border and thus influences background coverage and hit area. Visual and interactive affordances - such as clickable regions or touch targets - are often improved by increasing padding rather than border or margin.
In practice, padding-right behaves consistently across element types but its perceptible effect varies: on block-level boxes it shifts the content box inward horizontally, while on inline-level boxes it contributes to the inline box’s spacing and can affect line wrapping. It does not inherit from parent elements, so explicit values (or shorthands) must be set where needed. Designers and developers commonly animate padding to create smooth spacing transitions or adjust it responsively to control the balance between content and container on different screen sizes.
Definition
- Initial value
- 0
- Applies to
- All elements
- Inherited
- No
- Computed value
- <length> - the percentage as specified or the absolute length
- Animatable
- Yes
- JavaScript syntax
- object.style.paddingRight
Interactive Demo
Syntax
padding-right: [ <length> | <percentage> ]
Values
- <length>Specifies a positive fixed width.
- <percentage>A percentage with respect to the width of the containing block.
- inherit
Example
Browser Support
The following information will show you the current browser support for the CSS padding-right property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
