CSS - padding-left



Description

The padding-left property sets the width of the padding on the left of an element.

Possible Values

  • length − Any length value. Negative length values are not permitted for this property.

  • percentage − The left padding's width is calculated with respect to the width of the element's containing block.

Applies to

All the HTML elements.

DOM Syntax

 object.style.paddingLeft = "10px;"; 

Example

Here is the example −

 <html> <head> </head> <body> <p style = "padding-left: 15px; border:1px solid black;"> This is a paragraph with a specified left padding </p> <p style = "padding-left: 15%; border:1px solid black;"> This is another paragraph with a specified left padding in percent </p> </body> </html&gt 

This will produce following result −

Advertisements