CSS padding-left

The CSS padding-left property is used to create left padding for specified element. For example:

HTML with CSS Code
<!DOCTYPE html>
<html>
<head>
   <style>
      .myd{border: 2px solid coral; padding-left: 32px;}
   </style>
</head>
<body>
   
   <div class="myd">
      This is an example of padding-left property in CSS.
   </div>
   
</body>
</html>
Output
This is an example of padding-left property in CSS.

Note - Left padding is the width of area after the border and before the content, of specified element.

CSS padding-left Syntax

The syntax of padding-left property in CSS, is:

padding-left: x;

The value of x should be any of the following:

Note - To learn about padding in detail, refer to its separate tutorial.

CSS Online Test


« Previous Tutorial Next Tutorial »