Categories
Web development

CSS padding-left Property

The CSS padding-left property settles the left padding of an element.



CSS padding-left Property

The space between the content and its border is named padding.

The CSS padding-left property settles the left padding (left space) of an element.

Demo:

Click the “Try it” button to change the padding-left property of the paragraph (45px):



This is a paragraph.


Syntax:

padding-left: length;

length – defines fixed left padding in px, cm, etc.

Example:

<!DOCTYPE html>
<html>
<head>
<style>
p.ex1 {
  border: 1px solid #333; 
  padding-left: 60px;
}
</style>
</head>
<body>

<p class="ex1">This is a paragrpah with a 60px left padding.</p>

</body>
</html>

Output:

This is a paragrpah with a 60px left padding.


Enjoy coding!

Read also:

CSS margin-left Property

CSS border-left Property

CSS column-rule-color Property