Padding
Padding
Padding is a free HTML for Kids lesson on CoddyKit. This is lesson 1 of 1. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the HTML for Kids learning path, and your progress syncs across the web and the CoddyKit app. The HTML for Kids course includes 1 lessons in total.
Introduction
Hello,
Welcome to CSS Padding lesson.
It is used to create a space within the boundaries of our HTML element.
Just like the margin, we can add 4-way padding to the element.
Percent Type
In our previous example, we assigned a padding value that takes a static value in px type. Just like the margin, we can set the percent type value.
<!DOCTYPE html>
<html>
<head>
<style>
.box {
background-color: lightblue;
padding-top:10%;
padding-right: 10%;
padding-left: 10%;
padding-bottom:10%;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="box">
We assign percentage type
padding to this div element.
</div>
</body>
</html>
To shorten the code
Just like margin, it is possible to define in a single line with shortcut syntax in padding.
The values for the top, right, bottom and left paddings can be added with spaces, respectively.
Check out our sample code and you will see that it is very similar to the margin.
<!DOCTYPE html>
<html>
<head>
<style>
.box {
border: 1px solid black;
padding: 20px 10px 25px 10px;
background-color: powderblue;
}
</style>
</head>
<body>
<div class="box">
Lorem ipsum dolor sit amet,
consectetur
</div>
</body>
</html>Congratulations
Congratulations 🎉
In this section, we learned the CSS Margins.
In the next section, we will learn the Color and Background.

Learn HTML with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 16
- Lessons
- 35
Frequently Asked Questions
Is the “Padding” lesson free?
Yes — the full text of “Padding” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the HTML for Kids course, upgrade to CoddyKit PRO. The HTML for Kids course includes 1 lessons in total.
What will I learn in “Padding”?
Padding You practise HTML for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start HTML for Kids?
No prior experience is required. HTML for Kids on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 1.
How long does the “Padding” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this HTML for Kids lesson?
Yes. Every HTML for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.