padding

The padding property is a shorthand property for setting padding-top, padding-right, padding-bottom, and padding-left.

Syntax

padding: [ <length> | <percentage> ]{1,4} | inherit
Initial: 0
Applies To: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group, and table-column
Inherited: no
Percentages: refer to width of containing block
Media: visual

Values

padding: value
Value Initial Description
length 0 Specifies a fixed length
percentage Specifies a percentage of the containing block

DOM

[window.]document.getElementById("element-id").style.padding = "padding-top padding-right padding-bottom padding-left";

Example | length

Example | percentage

Example | DOM

External

W3C Cascading Style Sheets, level 1

W3C Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification