<!DOCTYPE html>
<html>
<head>
<title>Padding Examples</title>
<style>
p {
background-color: #4caf50;
color: white;
}
.p {
padding: 12px;
}
.pt {
padding-top: 12px;
}
.pl {
padding-left: 12px;
}
.pr {
padding-right: 12px;
}
.pb {
padding-botom: 12px;
}
</style>
</head>
<body>
<p class="p">Paragraph text with equal padding for all sides</p>
<p class="pt">Paragraph tezt with padding given at the top</p>
<p class="pl">Paragraph tezt with padding given at the left</p>
<p class="pr">Paragraph tezt with padding given at the right</p>
<p class="pb">Paragraph tezt with padding given at the bottom</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Padding Examples</title>
<style>
p {
background-color: #4caf50;
color: white;
}
.p1 {
padding: 10px;
}
.p2 {
padding: 15px 10px;
}
.p3 {
padding: 20px 15px 10px;
}
.p4 {
padding: 25px 20px 15px 10px;
}
</style>
</head>
<body>
<p class="p4">Paragraph text has differnt padding for each sides</p>
<p class="p3">Paragraph text has differnt padding for Top, Right and Bottom sides</p>
<p class="p2">Paragraph text has differnt padding for only Top and Right sides</p>
<p class="p1">Paragraph text has equal padding for each sides</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Padding Examples</title>
<style>
.box {
width: 200px;
height: 100px;
padding: 20px;
color: white;
background-color: #4caf50;
}
</style>
</head>
<body>
<p class="box">Paragraph box</p>
</body>
</html>
Property
Description
Example