source code of bcefirstproject.netlify.app

 source code of bcefirstproject.netlify.app:--------------




html code:--

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Card Display</title>
    <link rel="stylesheet" href="style.css">
   
</head>

<body>
    <header class="navbar">
        <div class="logo">Rishav Raunak</div>
        <nav id="nav-links">
            <a href="#">Home</a>
            <a href="#">About</a>
            <a href="#">Services</a>
            <a href="#">Contact</a>
            <a href="add.html">➕ Add New Card</a>
            <a href="" id="resetBtn">Reset All</a>

        </nav>
        <div class="hamburger" onclick="toggleMenu()">☰</div>
    </header>

    <main class="content">
        <h1>Welcome to Rishav Raunak</h1>
        <p>This is a sample responsive page with sticky navbar and footer.</p>
        <p>Scroll down to see the multiple cards and you also add new card.</p>
        <div style="height: 50px;"></div>
    </main>

    <div class="topbar">
        <h2>📋 Card List</h2>
        <!-- <div class="buttons">
            <a href="add.html">➕ Add New Card</a>
            <button id="resetBtn">🗑️ Reset All</button>
        </div> -->
    </div>

    <section class="cards-container" id="cards-container"></section>

    <footer class="footer">
        © 2025 MySite. All rights reserved.
    </footer>

   
    <script src="script.js"></script>

</body>

</html>

css code:--

*{
    margin: 0;
    padding: 0;
}
        body {
            font-family: sans-serif;
            padding: 0px;
            background-color: #f2f2f2;
        }

        .cards-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
        }

        .card {
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            transition: transform 0.3s;
        }

        .card:hover {
            transform: scale(1.03);
        }

        .card img {
            width: 100%;
            height: 180px;
            object-fit: cover;
        }

        .card .content {
            padding: 15px;
        }

        .card h3 {
            margin-bottom: 10px;
            font-size: 1.2rem;
        }

        .card p {
            font-size: 0.9rem;
            color: #555;
        }

        .topbar {
            display: flex;
            justify-content: space-between;
            margin-bottom: 20px;
        }

        .topbar a,
        .topbar button {
            text-decoration: none;
            background: #007bff;
            color: white;
            padding: 10px 15px;
            border-radius: 5px;
        }

        .topbar a:hover {
            background: #0056b3;
        }



        body,
        html {
            height: 100%;
            font-family: Arial, sans-serif;
            display: flex;
            flex-direction: column;
        }

        /* Navbar */
        .navbar {
            background: #333;
            color: white;
            padding: 10px 20px;
            position: sticky;
            top: 0;
            z-index: 100;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .navbar a {
            color: white;
            text-decoration: none;
            margin-left: 15px;
        }

        #nav-links {
            display: flex;
        }

        .hamburger {
            display: none;
            font-size: 24px;
            cursor: pointer;
        }

        /* Content */
        .content {
            flex: 1;
            padding: 20px;
            background-color: rgb(196, 193, 193);
        }

        /* Footer */
        .footer {
            background: #222;
            color: white;
            text-align: center;
            padding: 15px;
            position: sticky;
            bottom: 0;
            z-index: 100;
        }

        @media (max-width: 768px) {
            #nav-links {
                display: none;
                flex-direction: column;
                background: #444;
                position: absolute;
                top: 50px;
                right: 0;
                width: 200px;
            }

            #nav-links a {
                margin: 10px;
            }

            .hamburger {
                display: block;
            }

            #nav-links.show {
                display: flex;
            }
        }
   

java code--


        const container = document.getElementById("cards-container");

        const defaultCards = [

        ];

        function getStoredCards() {
            let stored = localStorage.getItem("customCards");
            return stored ? JSON.parse(stored) : [];
        }

        function createCard(card) {
            let div = document.createElement("div");
            div.className = "card";
            div.innerHTML = `
        <img src="${card.image}" alt="${card.title}">
        <div class="content">
          <h3>${card.title}</h3>
          <p>${card.description}</p>
        </div>
      `;
            container.appendChild(div);
        }

        // Load all cards
        function loadAllCards() {
            container.innerHTML = "";
            const allcards = [...defaultCards, ...getStoredCards()];
            allcards.forEach(createCard);
        }

        // Reset Button Event
        document.getElementById("resetBtn").addEventListener("click", () => {
            const confirmReset = confirm("Are you sure you want to delete all saved cards?");
            if (confirmReset) {
                localStorage.removeItem("customCards");
                alert("✅ All custom cards have been deleted.");
                loadAllCards();
            }
        });

        function toggleMenu() {
            document.getElementById("nav-links").classList.toggle("show");
        }

        window.onload = loadAllCards;
   

add htmlcode:--

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>Add Card</title>
  <style>
    body {
      font-family: sans-serif;
      background: #f0f0f0;
      padding: 20px;
    }

    .input-section {
      background: #fff;
      padding: 20px;
      border-radius: 8px;
      max-width: 400px;
      margin: auto;
      display: flex;
      flex-direction: column;
      gap: 10px;
      box-shadow: 0 0 10px rgba(0,0,0,0.1);
    }

    .input-section input,
    .input-section textarea {
      padding: 10px;
      font-size: 1rem;
      border: 1px solid #ccc;
      border-radius: 5px;
    }

    .input-section button {
      background: #007bff;
      color: white;
      padding: 10px;
      font-size: 1rem;
      border: none;
      border-radius: 5px;
      cursor: pointer;
    }

    .input-section button:hover {
      background: #0056b3;
    }

    a {
      display: block;
      margin-top: 20px;
      text-align: center;
      text-decoration: none;
      color: #007bff;
    }
  </style>
</head>
<body>

  <section class="input-section">
    <h2>Add New Card</h2>
    <input type="text" id="title" placeholder="Enter title" />
    <input type="text" id="image" placeholder="Enter image URL" />
    <textarea id="desc" placeholder="Enter description"></textarea>
    <button id="addBtn">Add Card</button>
  </section>

  <a href="index.html">🔁 Go to Card Display</a>

  <script>
    function saveCardToStorage(card) {
      let current = localStorage.getItem("customCards");
      let cards = current ? JSON.parse(current) : [];
      cards.push(card);
      localStorage.setItem("customCards", JSON.stringify(cards));
    }

    document.getElementById("addBtn").addEventListener("click", () => {
      let title = document.getElementById("title").value.trim();
      let image = document.getElementById("image").value.trim();
      let desc = document.getElementById("desc").value.trim();

      if (title && image && desc) {
        const newCard = { title, image, description: desc };
        saveCardToStorage(newCard);

        alert("✅ Card added successfully!");
        // Optionally redirect to display page
        // window.location.href = "index.html";
       
        // Clear form
        document.getElementById("title").value = "";
        document.getElementById("image").value = "";
        document.getElementById("desc").value = "";
      } else {
        alert("Please fill all fields!");
      }
    });
  </script>

</body>
</html>

thank you

Comments