Exercise 3 - Creating a Recipe Card
HTML And CSS Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spaghetti Carbonara Recipe</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, sans-serif;
background: linear-gradient(to bottom right, #faf3e0, #f5e8d0);
margin: 0;
padding: 40px;
}
h1, h2 {
color: #5a3317;
}
ul, ol {
padding-left: 25px;
line-height: 1.7;
}
.card {
max-width: 750px;
margin: auto;
background: #ffffff;
border-radius: 20px;
padding: 30px;
box-shadow: 0 8px 25px rgba(0,0,0,0.15);
transition: transform 0.2s ease;
}
.card:hover {
transform: scale(1.01);
}
.recipe-title {
font-size: 36px;
text-align: center;
margin-bottom: 20px;
font-weight: 700;
color: #7a4921;
letter-spacing: 1px;
}
.recipe-img {
width: 100%;
border-radius: 15px;
margin-bottom: 20px;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.ingredient-list li {
margin-bottom: 6px;
}
#instructions li {
margin-bottom: 12px;
}
.section-box {
background: #fff7ec;
padding: 18px 20px;
border-radius: 15px;
margin-bottom: 25px;
border-left: 5px solid #c27b43;
}
.section-box:hover {
background: #ffefd8;
}
</style>
</head>
<body>
<div class="card">
<h1 class="recipe-title">Spaghetti Carbonara</h1>
<img class="recipe-img"
src="https://uploads.onecompiler.io/442fuys4s/445h7v69k/Espaguetis_carbonara.jpg"
alt="Spaghetti Carbonara">
<div class="section-box">
<h2>Ingredients</h2>
<ul class="ingredient-list">
<li>200g spaghetti</li>
<li>2 eggs</li>
<li>1/2 cup grated Parmesan cheese</li>
<li>100g beef or turkey bacon (halal)</li>
<li>2 cloves garlic, minced</li>
<li>Salt & black pepper</li>
</ul>
</div>
<div class="section-box">
<h2>Cooking Instructions</h2>
<ol id="instructions">
<li>Boil spaghetti in salted water until al dente.</li>
<li>Cook bacon in a pan until crispy; add garlic for 1 minute.</li>
<li>Beat eggs with Parmesan cheese in a bowl.</li>
<li>Add drained spaghetti to the pan and mix.</li>
<li>Turn off heat and quickly stir in the egg-cheese mixture.</li>
<li>Season with black pepper and serve immediately.</li>
</ol>
</div>
</div>
</body>
</html>
Comments
Post a Comment