English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
padding-The left CSS attribute sets padding to the left, that is, the space between the left border and the content of the element. However, in many cases, the shorthand notation CSS attributepaddingMore commonly used and preferable.
The following table provides usage instructions and version history for this attribute, as well as the syntax of this attribute in JavaScript scripts.
Default Value: | 0 |
---|---|
Applies To: | All elements, except<tbody>,<thead>,<tfoot>,<tr>,<colgroup>and<col>. It also applies to::first-letter. |
Inheritance: | No |
Can be animated: | Yes.Please refer to Animation Attributes. |
Version: | CSS 1,2,3 |
JavaScript Syntax: | object.style.paddingLeft="2em" |
The syntax of this attribute is as follows:
padding-left: length | percentage | initial | inherit
The following examples demonstrate how to use padding-left Attribute.
h1 { padding-left: 2em; } p { padding-left: 50px; }Test See‹/›
The following table describes the value of this attribute.
Value | Description |
---|---|
length | Values in units such as px, pt, cm, em, etc., negative values are not allowed. |
percentage | Specify percentage padding. The percentage is calculated relative to the width of the element's containing block. Negative percentage values are not allowed. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated element uses its parent element padding-The left Attribute Value. |
padding-Browser Compatibility of the left Attribute, the numbers in the following table indicate the minimum browser version that supports this attribute; all mainstream browsers support this attribute.
|
See the following tutorials:CSS Padding,CSS Box Model.
Related Attributes:padding,padding-top,padding-right,padding-bottom.