HTML + CSS Beginner Worksheet — 3
This worksheet contains three beginner-friendly HTML + CSS mini-programs. Each program
includes: Purpose, Full code (copy into [Link]), and Practice exercises.
Program 1 — Greeting Card Page
Purpose: Learn background images, text styling, and alignment.
Code (copy into [Link]):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Greeting Card</title>
<style>
body {
background-image: url('[Link]
text=Happy+Day');
background-size: cover;
font-family: "Segoe UI", sans-serif;
text-align: center;
color: white;
padding-top: 150px;
height: 100vh;
margin: 0;
}
h1 {
font-size: 40px;
background: rgba(0, 0, 0, 0.4);
display: inline-block;
padding: 10px 20px;
border-radius: 12px;
}
p{
font-size: 20px;
margin-top: 15px;
text-shadow: 1px 1px 3px #000;
}
</style>
</head>
<body>
<h1>🌼 Have a Wonderful Day!</h1>
<p>Keep learning, keep growing!</p>
</body>
</html>
Exercises:
• Change the background image URL to another image of your choice.
• Reduce padding-top to 100px so text moves up.
• Remove the text-shadow and observe the difference.
Program 2 — Simple Pricing Card
Purpose: Practice box styling, shadows, and button design.
Code (copy into [Link]):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pricing Card</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f3f5fa;
text-align: center;
padding-top: 50px;
}
.card {
background-color: white;
display: inline-block;
padding: 20px;
width: 250px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
h2 {
color: #0b76ef;
}
.price {
font-size: 28px;
font-weight: bold;
margin: 15px 0;
}
.btn {
background-color: #0b76ef;
color: white;
border: none;
padding: 10px 20px;
border-radius: 6px;
cursor: pointer;
transition: 0.3s;
}
.btn:hover {
background-color: #085cc0;
}
</style>
</head>
<body>
<div class="card">
<h2>Basic Plan</h2>
<p>Perfect for Beginners</p>
<p class="price">$10/month</p>
<button class="btn">Choose Plan</button>
</div>
</body>
</html>
Exercises:
• Change the price to $20/month and update the text.
• Increase card width to 300px.
• Change button color to #28a745 (green) and adjust hover color.
Program 3 — Educational Banner
Purpose: Learn gradient background, center alignment with Flexbox, and button styling.
Code (copy into [Link]):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Education Banner</title>
<style>
body {
margin: 0;
font-family: 'Poppins', sans-serif;
text-align: center;
background: linear-gradient(135deg, #0b76ef, #4dd0e1);
color: white;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
h1 {
font-size: 40px;
margin: 0;
}
p{
font-size: 20px;
margin: 10px 0 30px;
}
.btn {
background-color: white;
color: #0b76ef;
padding: 10px 20px;
border: none;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
transition: 0.3s;
}
.btn:hover {
background-color: #085cc0;
color: white;
}
</style>
</head>
<body>
<h1>Welcome to Web Development</h1>
<p>Start your learning journey with HTML, CSS & JS 🚀</p>
<button class="btn">Start Now</button>
</body>
</html>
Exercises:
• Change the gradient colors to two colors of your choice.
• Add a second button 'Learn More' beside the first one.
• Center the buttons with a small gap between them.