π§βπ³ Build a Dynamic Recipe Website with Tailwind CSS & JavaScript (No Frameworks)
Description
π Live Features:
* Sticky navigation
* Responsive hero section with call to action
* Dynamically generated recipe cards
* Recipe search by keyword, category, or ingredient
* Modal popups with recipe details
* Contact form with Font Awesome icons
* Auto-updating copyright
π§± Step 1: Project Setup
Create the folder structure:
π dynamic-recipe-site/
βββ index.html
βββ style.css (optional)
βββ script.js
π Step 2: Build the Layout (HTML + Tailwind)
π§ Sticky Navbar
π Hero Section
Welcome to Tasty Recipes
Discover a world of delicious recipes and culinary inspiration.
Explore Recipes
πFeatured Recipes Section
Featured Recipes
Search Recipes
<input class="w-full md:w-1/2 px-4 py-2 rounded-full border border-gray-300 focus:ring focus:ring-amber-200 focus:outline-none" id="search-input" type="text" />
<button class="bg-amber-500 text-white py-2 px-6 rounded-full hover:bg-amber-600 transition duration-300 ml-4 font-semibold" id="search-button">
Search
</button>
π Step 3: About & Contact Sections
π About Us
About Us
Welcome to Tasty Recipes, your go-to source for delicious and
inspiring recipes from around the world.
Our mission is to provide you with high-quality, easy-to-follow
recipes that will help you create memorable meals.
π Contact Form
Contact Us
Have a question or suggestion? We'd love to hear from you!
Email us at: support@tastyrecipes.com
<form action="#" class="mt-8 max-w-md mx-auto bg-white p-6 rounded-lg shadow-lg flex flex-col gap-4" method="POST">
<input class="w-full px-4 py-2 rounded-full border border-gray-300 focus:ring focus:ring-amber-200 focus:outline-none" id="name" required="required" type="text" />
<input class="w-full px-4 py-2 rounded-full border border-gray-300 focus:ring focus:ring-amber-200 focus:outline-none" id="email" required="required" type="email" />
<textarea class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:ring focus:ring-amber-200 focus:outline-none" id="message" required="required"></textarea>
<button class="bg-amber-500 text-white py-2 px-6 rounded-full hover:bg-amber-600 transition duration-300" type="submit">
Send Message
</button>
</form>
π Footer
βοΈ Step 5: Load Recipes Dynamically with JavaScript
const recipes = [
{
title: "Spaghetti Carbonara",
category: "Pasta",
image: "https://www.themealdb.com/images/media/meals/wvqpwt1468339226.jpg",
ingredients: [
"200g spaghetti",
"100g pancetta",
"2 large eggs",
"50g Pecorino Romano cheese",
"Black pepper",
"Salt",
],
instructions: [
"Cook the spaghetti in salted boiling water until al dente.",
"While the pasta is cooking, cut the pancetta into small cubes and fry until crispy.",
"In a bowl, whisk together the eggs, cheese, and a generous amount of black pepper.",
"Drain the spaghetti and add it to the pancetta pan. Mix well.",
"Remove the pan from the heat and add the egg mixture, stirring quickly to create a creamy sauce.",
"Serve immediately with extra cheese and pepper.",
],
},
{
title: "Classic Margherita Pizza",
category: "Pizza",
image: "https://www.themealdb.com/images/media/meals/x0lk931587671540.jpg",
ingredients: [
"250g strong bread flour",
"1 tsp dried yeast",
"1 tsp sugar",
"1 tsp salt",
"150ml warm water",
"2 tbsp olive oil",
"100g tomato sauce",
"150g mozzarella cheese",
"Fresh basil leaves",
],
instructions: [
"In a large bowl, combine flour, yeast, sugar, and salt.",
"Add warm water and olive oil, and mix to form a dough.",
"Knead the dough for about 10 minutes until smooth.",
"Let the dough rise in a warm place for 1 hour.",
"Preheat oven to 220Β°C (425Β°F).",
"Roll out the dough on a floured surface.",
"Spread tomato sauce over the base, add mozzarella cheese, and bake for 15-20 minutes.",
"Garnish with fresh basil leaves before serving.",
],
},
{
title: "Chocolate Brownies",
category: "Dessert",
image: "https://www.themealdb.com/images/media/meals/yypvst1511386427.jpg",
ingredients: [
"150g unsalted butter",
"200g dark chocolate",
"150g sugar",
"2 large eggs",
"100g all-purpose flour",
"30g cocoa powder",
"1 tsp vanilla extract",
"Pinch of salt",
],
instructions: [
"Preheat oven to 180Β°C (350Β°F). Grease and line a square baking tin.",
"Melt butter and chocolate together over low heat.",
"In a bowl, whisk together sugar and eggs until light and fluffy.",
"Stir in the melted chocolate mixture and vanilla extract.",
"In a separate bowl, whisk together flour, cocoa powder, and salt.",
"Gently fold the dry ingredients into the wet ingredients until just combined.",
"Pour the batter into the prepared tin and bake for 20-25 minutes.",
"Let it cool completely before cutting into squares.",
],
},
{
title: "Fresh Garden Salad",
category: "Salad",
image: "https://www.themealdb.com/images/media/meals/urtwux1486983078.jpg",
ingredients: [
"6 cups mixed salad greens",
"2 medium t






















