انتقل للمحتوى
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

Gradients, shadows and corners

Section 5: Pro CSS: shadows and movementLesson 5.1 · ⏱ 8 min

Three properties make any card look pro: a gradient instead of one colour, a shadow under it, and round corners.

  • linear-gradient(135deg, colour1, colour2): it goes from one colour to another, and 135deg is the direction.
  • box-shadow: 0 12px 30px: the shadow goes down 12 pixels, and its softness is 30 pixels.
  • rgba(0, 0, 0, 0.25): black that you can see through, at 25%.
  • border-radius: 20px: every corner becomes round.
HTML
<div class="card">
  <h2>Robo Egypt</h2>
  <p>I make robots and websites.</p>
</div>
CSS
body { font-family: Tahoma, sans-serif; background: #eef1ff; }
.card {
  width: 260px;
  margin: 30px auto;
  padding: 24px;
  color: white;
  border-radius: 20px;
  background: linear-gradient(135deg, #6a5cff, #ff5c9d);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
🖥️ The page in Robo Web:The page in Robo Web
  1. Change the direction to 90deg, then to 180deg, and notice the difference.
  2. Make the shadow bigger and softer: 0 20px 50px.

📌 Another example: a shiny button

A gradient of two colours, a coloured shadow and round corners.

🌐 A shiny button
HTML
<button class="shiny">⚡ Sign up now</button>
CSS
body { font-family: Tahoma, sans-serif; text-align: center; padding-top: 40px; background: #F4F6FF; }
.shiny {
  font-size: 22px;
  padding: 14px 36px;
  border: none;
  border-radius: 14px;
  color: white;
  background: linear-gradient(90deg, #18B37E, #1E7BFF);
  box-shadow: 0 8px 20px rgba(30, 123, 255, 0.4);
}
🖥️ The page in Robo Web:The page in Robo Web
✍️ Practise
Try the example here: copy the code into its tabs, change it, and watch the page change.
✍️ Practise here in the lessonor open the lab in a new page ↗

🎯 Challenge yourself

Easy

The page background is a gradient from the top (sky blue) to the bottom (white).

👀 Show the solution
🌐 Solution
HTML
<h1>Sky</h1>
CSS
body {
  height: 100vh;
  margin: 0;
  background: linear-gradient(skyblue, white);
}
🖥️ The page in Robo Web:The page in Robo Web

Result: a gradient sky.

Medium

A card with a shadow and 20px corners.

👀 Show the solution
🌐 Solution
HTML
<div class="card">A flying card ☁️</div>
CSS
body { padding: 30px; }
.card {
  padding: 30px;
  border-radius: 20px;
  background: white;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
🖥️ The page in Robo Web:The page in Robo Web

Result: a card lifted up by a shadow.

Hard

A circle with a round gradient (radial-gradient) that looks like a ball.

👀 Show the solution
🌐 Solution
HTML
<div class="ball"></div>
CSS
body { padding: 30px; }
.ball {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #FFE08A, #FF7A00);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
}
🖥️ The page in Robo Web:The page in Robo Web

Result: an orange ball.

Finished the lesson? Mark it so your progress counts.