π οΈ Section project: a player card
Section 2: CSS: the page's lookLesson 2.5 Β· β± 10 min
π― Project goal
A card with a player's name and team, with a background, space inside and round corners, and the name in a different colour.
HTML
<div class="card">
<h2>Mo Salah</h2>
<p>Liverpool β½</p>
</div>
CSS
body { font-family: Tahoma; }
.card {
background: #C8102E;
color: white;
padding: 20px;
border-radius: 18px;
width: 220px;
text-align: center;
}
.card h2 {
color: #FFD43B;
}
π₯οΈ The page in Robo Web:

π Another example: a team card
One card with an emoji picture, a name and some facts, repeated in a row.
HTML
<div class="team">
<div class="card"><div class="face">π¦</div><h3>Lions</h3><p>Points: 30</p></div>
<div class="card"><div class="face">π¦
</div><h3>Eagles</h3><p>Points: 24</p></div>
</div>
CSS
body { font-family: Tahoma, sans-serif; }
.card {
width: 200px;
margin: 10px auto;
padding: 16px;
text-align: center;
border-radius: 18px;
background: #1B2350;
color: white;
}
.card .face { font-size: 60px; }
.team { display: flex; gap: 12px; justify-content: center; }
π₯οΈ The page in Robo Web:

βοΈ Practise
A player card.
βοΈ Practise here in the lessonβ Close the labor open the lab in a new page β
π― Challenge yourself
Easy
A card with an emoji and a name.
π Show the solutionπ Hide the solution
HTML
<div class="card"><div class="face">πΌ</div><h3>Panda</h3></div>
CSS
body { font-family: Tahoma, sans-serif; }
.card {
width: 200px;
margin: 10px auto;
padding: 16px;
text-align: center;
border-radius: 18px;
background: #1B2350;
color: white;
}
.card .face { font-size: 60px; }
π₯οΈ The page in Robo Web:

Result: a navy card.
Medium
Add a power bar to the card: a box 70% wide.
π Show the solutionπ Hide the solution
HTML
<div class="card">
<div class="face">πΌ</div>
<h3>Panda</h3>
<div class="bar"><div class="fill"></div></div>
</div>
CSS
body { font-family: Tahoma, sans-serif; }
.card {
width: 200px;
margin: 10px auto;
padding: 16px;
text-align: center;
border-radius: 18px;
background: #1B2350;
color: white;
}
.card .face { font-size: 60px; }
.bar { background: #444; border-radius: 8px; }
.fill { width: 70%; height: 12px; border-radius: 8px; background: #FFBF00; }
π₯οΈ The page in Robo Web:

Result: a yellow bar at 70%.
Hard
Three cards in a grid of 3 columns.
π Show the solutionπ Hide the solution
HTML
<div class="team">
<div class="card"><div class="face">πΌ</div><h3>Panda</h3></div>
<div class="card"><div class="face">π―</div><h3>Tiger</h3></div>
<div class="card"><div class="face">π¨</div><h3>Koala</h3></div>
</div>
CSS
body { font-family: Tahoma, sans-serif; }
.card {
margin: 0;
padding: 16px;
text-align: center;
border-radius: 18px;
background: #1B2350;
color: white;
}
.card .face { font-size: 60px; }
.team { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
π₯οΈ The page in Robo Web:

Result: three cards in a row.

