Change Language


Follow Navioo On Twitter

padding

Specifies the amount of padding space between the content of an element and its border.

Browser/User Agent Support

IE Netscape Mozilla Opera Safari
4.0+ 4.0+ 1.0+ 4.0+ 1.0+

Usage

[top] [right] [bottom] [left]

Example

To specify a padding that is 10px wide on the top and left and 5px wide on the bottom and right, use the following syntax: body {padding: 10px 5px 5px 10px;}.

Remarks

Use the padding property as a shortcut to typing out all of the individual padding properties separately. You can specify any valid value for a padding property as part of padding.

You can specify up to four different widths for the amound of padding for an element.

  • For padding that is the same on all four sides, specify a single value.
  • For padding that is different on the top/bottom and left/right sides, specify two values with the top/bottom value first.
  • For padding that is different on the top, left/right, and bottom sides, specify three values with the top value first, followed by the left/right and then bottom values.
  • For padding with four different widths, specify four values in the order of top, right, bottom, and left.

Availability

W3C CSS2

Related

Examples -> Source code Demo online - > padding:

Ajax Javascript feed

↑ Grab this Headline Animator