Easy Tutorial
❮ Prop Element Classlist Jsref Escape ❯

Style paddingLeft Property


Definition and Usage

The paddingLeft property sets or returns the left padding of an element.

Syntax

Set the paddingLeft property:

Return the paddingLeft property:

Value Description
% Defines the left padding as a percentage of the parent element's width.
length Defines the width of the left padding using units like px, cm, etc.
inherit The left padding is inherited from the parent element.

Browser Support

All major browsers support the paddingLeft property.

Note: IE7 and earlier versions do not support the "inherit" value. IE8 requires !DOCTYPE to support "inherit". IE9 supports "inherit".


Tips and Notes

Both the margin and padding properties insert space around an element. However, the difference is that margin inserts space outside the border, while padding inserts space inside the element's border.


Example

Change the left padding of a div element:


❮ Prop Element Classlist Jsref Escape ❯