The padding-left property in CSS is used to add space between the content and the left border of an element. It helps improve the spacing and appearance of webpage elements.
- It sets the width of the left padding area of an element.
- Padding is the space between the content and the border.
- The value can be defined using units like px, %, or em.
Syntax:
padding-left: length | percentage | initial | inherit;
Property values:
- length: This mode is used to specify the size of padding as a fixed value. The default value is 0. It must be non-negative.
- percentage: This mode is used to specify the left padding in percent of the width of the element. It must be non-negative.
- initial: This property is used to set padding-left to its default value. : This property is used to set padding-left to its default value.
Example 1: Here, we are using padding-left: length; property.
Example 2: Here, we are using padding-left: percentage; property.