The box: padding and border
Section 2: CSS: the page's lookLesson 2.2 · ⏱ 8 min
Every element is a box: padding is the space inside it, border its frame, border-radius rounds its corners, and margin is the space outside it.
HTML
<div class="box">I am a box 📦</div>
CSS
body { font-family: Tahoma; }
.box {
background: #FFF3D6;
padding: 24px;
border: 4px solid #FF8A1F;
border-radius: 16px;
}
🖥️ The page in Robo Web:

📌 Note
.box with a dot chooses every element with class="box".📌 Another example: a big round button
padding makes the button bigger from the inside, and border-radius rounds its corners.
HTML
<button class="big">Start playing ▶</button>
CSS
body { font-family: Tahoma, sans-serif; text-align: center; padding-top: 30px; }
.big {
font-size: 24px;
padding: 14px 40px;
border: 3px solid #1B2350;
border-radius: 30px;
background: #FFBF00;
}
🖥️ The page in Robo Web:

✍️ Practise
The box.
✍️ Practise here in the lesson✖ Close the labor open the lab in a new page ↗
🎯 Challenge yourself
Easy
A box with a red frame 4px thick.
👀 Show the solution🙈 Hide the solution
HTML
<div class="box">My box</div>
CSS
.box { border: 4px solid red; }
🖥️ The page in Robo Web:

Result: a red frame.
Medium
A box with 20px of space inside, and round corners of 16px.
👀 Show the solution🙈 Hide the solution
HTML
<div class="box">Card</div>
CSS
.box {
padding: 20px;
border-radius: 16px;
background: #E8F0FF;
}
🖥️ The page in Robo Web:

Result: a round card.
Hard
A circle: a 100 × 100 box with border-radius: 50%.
👀 Show the solution🙈 Hide the solution
HTML
<div class="circle"></div>
CSS
.circle {
width: 100px;
height: 100px;
border-radius: 50%;
background: #18B37E;
}
🖥️ The page in Robo Web:

Result: a green circle.

