1. Computing

Discuss in my forum

padding

By , About.com Guide

padding Description:

The padding property is a shorthand property that defines the padding on all sides 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:

No initial value is defined for shorthand properties.

padding Applies To:

All elements except tbody, thead, tfoot, tr, colgroup, and col.

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, such as color or background image of the element.

More padding Information:

©2013 About.com. All rights reserved.