Exercise 3 - Creating a Recipe Card

 



This website is a simple recipe card designed using HTML and CSS. It features a clean and modern layout showcasing the “Spaghetti Carbonara” recipe. The recipe card includes the dish’s title, a high-quality image, a detailed list of ingredients, and step-by-step cooking instructions. The webpage uses a combination of element selectors, class selectors, and ID selectors to style different parts of the page, providing a visually appealing and easy-to-read format. The design includes a soft color theme, rounded corners, hover effects, and a responsive card layout to enhance the user experience. This website serves as a beginner-friendly demonstration of how HTML structure and CSS styling can be combined to create an attractive, functional 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

Popular posts from this blog

Simple Personal Profile Page

Final Project Website Redesign

Prototype Development: CAVS 55 Event Page Redesign