Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Box Model and Sizing

The padding-right property

Reference for the CSS padding-right property: syntax, values, percentages, use for icons and inputs, examples and browser support.

The padding-right property sets the space between an element's content and its right border. The element's background fills the space, and scrollable content stops that distance from the right edge.

CSS
input.search {
  padding-right: 2.5rem; /* room for an icon */
}

Try it

Right padding

Syntax

CSS
padding-right: <length> | <percentage>
  • Initial value: 0
  • Applies to: all elements except internal table row groups, header groups, footer groups, rows and column groups
  • Inherited: no
  • Percentages: relative to the width of the containing block
  • Animatable: yes
  • Computed value: the percentage as specified or the absolute length

Values

Value Description
<length> A fixed size such as 1rem or 12px. Must not be negative.
<percentage> A share of the containing block's width.

Usage notes

  • Room for icons. Reserve space on the right of an input or button with padding-right, then place the icon with absolute positioning inside a wrapper.
  • Width effects. With box-sizing: content-box, right padding makes the box wider; with border-box, it shrinks the content area.
  • Right-to-left text. Use padding-inline-end so the spacing follows the text direction.

Browser support

Supported in every browser.