CSS padding-left property

CSS Padding-left Property

Description

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

Possible Values

  • length − Any length value. Negative values ​​are not allowed.
  • percentage − The left padding is calculated relative to the width of the element’s containing block.


Applies to

All HTML elements.

DOM syntax

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

Example

This is an 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>

This will produce the following −

CSS padding-left property

Leave a Reply

Your email address will not be published. Required fields are marked *