Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Container Queries and Logical Properties

The padding-inline property

Reference for the CSS padding-inline shorthand: logical padding along the inline axis, direction awareness, examples and usage notes.

The padding-inline shorthand sets the space inside an element at the start and end of the inline axis. In left-to-right horizontal text that is the left and right padding; in right-to-left text the start side is the right. In vertical writing modes the inline axis is vertical, so the padding appears above and below.

It sets padding-inline-start and padding-inline-end. It is ideal for components that must mirror in right-to-left languages, such as buttons, list items and menus.

CSS
.menu li { padding-inline: 1rem 2rem; }

Try it

Inline padding
Mirrors with direction

Syntax

CSS
padding-inline: <'padding-left'>{1,2};
  • Initial value: 0
  • Applies to: the same elements as padding
  • Inherited: no
  • Percentages: relative to the inline size of the containing block
  • Animatable: yes
  • Computed value: as specified, with lengths made absolute

Values

Value Description
One value Applied to both inline-start and inline-end padding.
Two values The first is inline-start, the second inline-end.
<length> A fixed size. Negative values are invalid.
<percentage> A share of the containing block's inline size.

Usage notes

  • Start and end, not left and right. The first value follows the text direction, set by the dir attribute or direction property. That is the main reason to prefer it over padding-left and padding-right.
  • Safe for icons and bullets. A gutter on padding-inline-start stays on the correct side when the page is translated into a right-to-left language.
  • Combine with padding-block. padding-block: 0.5rem; padding-inline: 1rem; is a compact, direction-proof button padding.
  • Specificity with the physical forms. padding-inline and padding-left set the same underlying box value, so whichever comes later in the cascade (at equal specificity) wins. Avoid mixing them on one element.
  • Not for the content box size. With box-sizing: content-box, padding increases the element's total width.

Browser support

Supported in all current browsers.