انتقل للمحتوى
Robo EgyptRobo Egypt
☰ Course contents
Robo Web: home
0. Lab tour1
1. HTML: the page's content7
2. CSS: the page's look6
3. JavaScript: the actions7
4. The project: the to-do list3
5. Pro CSS: shadows and movement5
6. Arrays and building the page with code3
7. Events and forms3
8. Objects and time3
9. Canvas: drawing and games3
10. The final project: the memory game3

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: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.

🌐 A big round button
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:The page in Robo Web
✍️ Practise
The box.
✍️ Practise here in the lessonor open the lab in a new page ↗

🎯 Challenge yourself

Easy

A box with a red frame 4px thick.

👀 Show the solution
🌐 Solution
HTML
<div class="box">My box</div>
CSS
.box { border: 4px solid red; }
🖥️ The page in Robo Web: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
🌐 Solution
HTML
<div class="box">Card</div>
CSS
.box {
  padding: 20px;
  border-radius: 16px;
  background: #E8F0FF;
}
🖥️ The page in Robo Web:The page in Robo Web

Result: a round card.

Hard

A circle: a 100 × 100 box with border-radius: 50%.

👀 Show the solution
🌐 Solution
HTML
<div class="circle"></div>
CSS
.circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #18B37E;
}
🖥️ The page in Robo Web:The page in Robo Web

Result: a green circle.

Finished the lesson? Mark it so your progress counts.