← Back to properties

CSS Property

padding

Spacing

Sets the space between an element's content and its border.

Syntax

padding: value;

Example

padding: 1rem 2rem;

Common use cases

  • Adding inner spacing to buttons and cards
  • Controlling clickable area size
  • Creating breathing room inside containers

Practical developer insight

padding adds to the element's total size unless you set box-sizing: border-box — which should be your default in every project.

Related properties