Definition:
CSS padding-left applies padding to element’s left inside the defined border.
Syntax:
padding-left: 10px;
Source Code:
See the below example without and with padding-right property.
<!DOCTYPE html>
<html>
<head>
<style>
.paragraph1{
border: 2px dashed red;
background-color: pink;
text-align:center;
}
.paragraph2{
border: 2px dashed red;
background-color: orange;
text-align:center;
padding-left: 10px;
}
</style>
</head>
<body>
<div class="paragraph1">This is a first paragraph without padding-left property;
<div class="paragraph2">This is a second paragraph with Padding-left is 10px from the defined border; </div>
</body>
</html>
Output:
You may be interested in the following topics:
- CSS Padding-left
- CSS Padding-bottom
- CSS Padding-right
- CSS Padding-top
- CSS Padding
- CSS Padding (All Properties)