Skip to Content
✨ v2.2.4 Released - See the release notes
DocumentationMCA-420 (B) : Lab on Web Programming3. HTML5 E-Commerce Website

Q3. Design a Website with HTML5

Question 3:
Design a website with HTML5.

In this assignment, we will build a single-page e-commerce website using HTML5 semantic elements such as <header>, <nav>, <main>, <section>, <article>, and <footer>.
The design includes a simple homepage with a product showcase and a call-to-action.


Example: E-Commerce Homepage

File Name: ecommerce.html

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>ShopNow - E-Commerce</title> </head> <body> <!-- Header --> <header> <div class="logo">ShopNow</div> <nav> <a href="#">Home</a> <a href="#products">Products</a> <a href="#about">About</a> <a href="#contact">Contact</a> </nav> </header> <!-- Hero Section --> <section class="hero"> <h1>Welcome to ShopNow</h1> <p>Your one-stop shop for latest products</p> <a href="#products" class="btn">Shop Now</a> </section> <!-- Products Section --> <main id="products"> <h2>Featured Products</h2> <section class="product-grid"> <article class="product"> <img src="/lab_web/html5/img/earphone.jpg" alt="earphone 1" /> <h3>Wireless Headphones</h3> <p class="price">₹1,199</p> <button>Add to Cart</button> </article> <article class="product"> <img src="/lab_web/html5/img/smartwatch.webp" alt="smartwatch 2" /> <h3>Smartwatch</h3> <p class="price">₹2,499</p> <button>Add to Cart</button> </article> <article class="product"> <img src="/lab_web/html5/img/bagpack.webp" alt="bagpack 3" /> <h3>Backpack</h3> <p class="price">₹499</p> <button>Add to Cart</button> </article> </section> </main> <!-- About Section --> <section id="about" class="about"> <h2>About Us</h2> <p> ShopNow is a demo e-commerce store created with HTML5 for learning purposes. We bring you the latest products at unbeatable prices. </p> </section> <!-- Contact Section --> <section id="contact" class="contact"> <h2>Contact Us</h2> <form> <input type="text" placeholder="Your Name" required /> <input type="email" placeholder="Your Email" required /> <textarea placeholder="Message" required></textarea> <button type="submit">Send</button> </form> </section> <!-- Footer --> <footer> <p> © 2025 ShopNow. All rights reserved. Create By ~ Ansari Intesab </p> </footer> </body> </html>

File Name: ecommerce.css

/* * Author: Ansari In */ /* General Reset */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; background: #f9f9f9; color: #333; } /* Header */ header { background: #2575fc; color: #fff; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; } header .logo { font-size: 24px; font-weight: bold; } header nav a { color: #fff; margin: 0 12px; text-decoration: none; font-weight: 500; } header nav a:hover { text-decoration: underline; } /* Hero Section */ .hero { text-align: center; padding: 80px 20px; background: linear-gradient(135deg, #6a11cb, #2575fc); color: #fff; } .hero h1 { font-size: 42px; margin-bottom: 15px; } .hero p { font-size: 18px; margin-bottom: 25px; } .hero .btn { background: #fff; color: #2575fc; padding: 12px 25px; border-radius: 25px; text-decoration: none; font-weight: bold; transition: 0.3s; } .hero .btn:hover { background: #f1f1f1; } /* Product Section */ #products { padding: 50px 20px; text-align: center; } .product-grid { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-top: 30px; } .product { background: #fff; border-radius: 12px; box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.1); padding: 20px; width: 250px; transition: transform 0.3s; } .product:hover { transform: translateY(-8px); } .product img { width: 100%; border-radius: 8px; margin-bottom: 15px; } .product h3 { margin-bottom: 10px; font-size: 18px; } .product .price { font-weight: bold; color: #2575fc; margin-bottom: 15px; } .product button { background: #2575fc; color: #fff; border: none; padding: 10px 18px; border-radius: 8px; cursor: pointer; } .product button:hover { background: #1a5edc; } /* About Section */ .about { padding: 50px 20px; background: #fff; text-align: center; } .about p { max-width: 700px; margin: auto; } /* Contact Section */ .contact { padding: 50px 20px; text-align: center; background: #f0f0f0; } .contact form { max-width: 500px; margin: auto; display: flex; flex-direction: column; gap: 15px; } .contact input, .contact textarea { padding: 12px; border: 1px solid #ccc; border-radius: 8px; } .contact button { background: #2575fc; color: #fff; border: none; padding: 12px; border-radius: 8px; cursor: pointer; } .contact button:hover { background: #1a5edc; } /* Footer */ footer { text-align: center; padding: 20px; background: #222; color: #ccc; }

Output Preview : HTML5 E-Commerce Website

Last updated on