Are you looking to add a dynamic gaming leaderboard to your website or project? In this tutorial, we’ll walk through the process of building a stylish and functional leaderboard using HTML and CSS. Whether you’re showcasing high scores, rankings, or achievements, this guide will help you create a visually appealing leaderboard that enhances user engagement. Let’s dive in!
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gaming Leaderboard</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="leaderboard">
<h1>🏆 Gaming Leaderboard 🏆</h1>
<table class="leaderboard-table">
<thead>
<tr>
<th>Rank</th>
<th>Player</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<tr>
<td class="rank">#1</td>
<td class="username"><img src="https://i.pravatar.cc/150?img=1" alt="Avatar" class="avatar">ProGamer123</td>
<td class="score">10,500</td>
</tr>
<tr>
<td class="rank">#2</td>
<td class="username"><img src="https://i.pravatar.cc/150?img=2" alt="Avatar" class="avatar">GameMaster99</td>
<td class="score">9,800</td>
</tr>
<tr>
<td class="rank">#3</td>
<td class="username"><img src="https://i.pravatar.cc/150?img=3" alt="Avatar" class="avatar">PixelWarrior</td>
<td class="score">9,200</td>
</tr>
<tr>
<td class="rank">#4</td>
<td class="username"><img src="https://i.pravatar.cc/150?img=4" alt="Avatar" class="avatar">LevelUpQueen</td>
<td class="score">8,900</td>
</tr>
<tr>
<td class="rank">#5</td>
<td class="username"><img src="https://i.pravatar.cc/150?img=5" alt="Avatar" class="avatar">EpicGamerX</td>
<td class="score">8,500</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Now add CSS.
CSS
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');
body {
font-family: 'Roboto', sans-serif;
background-color: #1a1a2e;
margin: 0;
padding: 20px;
color: #fff;
}
.leaderboard {
max-width: 800px;
margin: 0 auto;
background-color: #16213e;
border-radius: 15px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
overflow: hidden;
}
.leaderboard h1 {
background-color: #0f3460;
color: #fff;
padding: 25px;
margin: 0;
text-align: center;
font-size: 28px;
letter-spacing: 2px;
text-transform: uppercase;
}
.leaderboard-table {
width: 100%;
border-collapse: separate;
border-spacing: 0 10px;
}
.leaderboard-table th,
.leaderboard-table td {
padding: 15px;
text-align: left;
}
.leaderboard-table th {
background-color: #1a1a2e;
color: #e94560;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
}
.leaderboard-table tr {
background-color: #1f4068;
transition: all 0.3s ease;
}
.leaderboard-table tr:hover {
transform: scale(1.02);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
.rank {
font-weight: bold;
color: #e94560;
font-size: 18px;
width: 50px;
}
.username {
color: #fff;
font-size: 16px;
}
.score {
font-weight: bold;
color: #3282b8;
font-size: 18px;
}
.avatar {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
vertical-align: middle;
}
@media (max-width: 600px) {
.leaderboard-table th,
.leaderboard-table td {
padding: 10px;
}
.leaderboard h1 {
font-size: 22px;
}
.rank,
.score {
font-size: 16px;
}
.username {
font-size: 14px;
}
.avatar {
width: 30px;
height: 30px;
}
}
Jameel Rathore
Hello! My name is Jameel Rathore, and I’m excited to share insights on web development topics. With expertise in HTML, CSS, and WordPress, I blend creativity with technical know-how in every article. My goal is to offer valuable insights and tips,