HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link name="favicon" type="image/x-icon" href="https://skillzam.com/uploads/system/e353194f3b7cd1b75d69c3ab88041985.png" rel="shortcut icon" />
<title>Padding</title>
<style>
/* padding shorthand property is set for the h1 heading element */
h1 {
text-align: center;
background-color: cornflowerblue;
border: 3px solid indigo;
padding: 30px 20% 30px 20%;
}
/* para1 & para3 classes are set the left padding to "50%" of the viewport */
.para1, .para3 {
padding-left: 50%;
border: 2px solid indigo;
}
/* para2 & para4 classes are set the right padding to "50%" of the viewport */
.para2, .para4 {
padding-right: 50%;
border: 2px solid indigo;
}
</style>
</head>
<body>
<!--
Padding property is used to generate space around an element's content, inside of any defined borders.
Padding properties for specific sides of an element:
- padding-top : sets the top-side padding of an element.
- padding-right : sets the right-side padding of an element.
- padding-bottom : sets the bottom-side padding of an element.
- padding-left : sets the left-side padding of an element.
- padding : property is a shorthand representation.
-->
<h1>Demo: Padding</h1>
<p class="para1">Lorem, ipsum dolor sit amet consectetur adipisicing elit. Natus eaque illo, aperiam quibusdam corrupti officiis porro aliquam esse soluta sed.</p>
<p class="para2">Lorem ipsum dolor sit amet consectetur adipisicing elit. Cupiditate, quia magni? Non perspiciatis consequuntur dignissimos labore animi eaque. Illo, veritatis.</p>
<p class="para3">Lorem ipsum dolor sit amet consectetur adipisicing elit. Enim dolorum quisquam explicabo expedita quaerat eius, illo perferendis sunt ipsa doloribus!</p>
<p class="para4">Lorem ipsum dolor sit amet consectetur adipisicing elit. Enim dolorum quisquam explicabo expedita quaerat eius, illo perferendis sunt ipsa doloribus!</p>
</body>
</html>