Definition:
CSS padding-top applies padding to the element’s top inside the defined border.
Syntax:
padding-top: 10px;
Source Code:
See the below example, without and with padding-top 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-top: 10px;
}
</style>
</head>
<body>
<div class="paragraph1">This is a first paragraph without padding-top property;
<div class="paragraph2">This is a second paragraph with Padding-top is 10px from the defined border; </div>
</body>
</html>
Output:
You may be interested in the following topics: