1. Home
  2. Computing & Technology
  3. Web Design / HTML

padding

By Jennifer Kyrnin, About.com

padding Description:

The padding property is a shorthand tag to define all the paddings of an element.

padding in CSS Versions:
padding Syntax:

padding: [ <length> | <percentage> ]{1,4}
padding: <padding-top> <padding-right> <padding-bottom> <padding-left>

  • length
    A specific length (include unit of measure).
  • percentage
    A percentage of the height of the closest block-level ancestor.
padding Initial Value:

Not defined for shorthandproperties.

padding Applies To:

All elements.

padding Inheritance:

This property is not inherited.

padding Browser Support:
padding Examples:

standard padding

<p style="padding : 2em;">
This paragraph has a 2 em top padding.
</p>

set top and bottom the same and right and left the same

<p style="padding : 2em 1em;">
This paragraph has a 2 em padding on the top and bottom and a 1em padding on the right and left.
</p>
padding Special Notes:
  • Negative values are not permitted.
  • The padding will inherit the background properties of the element.
More padding Information:

Return to the Style Library

Explore Web Design / HTML
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. About.com Web Design A to Z
  5. Books
  6. About Web Design Book
  7. AWD: Chapter 12
  8. CSS Style Property: padding>

©2009 About.com, a part of The New York Times Company.

All rights reserved.