Skip to content

Sanketh166/EliteCommerce

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EliteCommerce

Building EliteCommerce: A Premium E-Commerce Site with Vanilla HTML, CSS & JavaScript

EliteCommerce is a fully functional e-commerce website built with just HTML, CSS, and vanilla JavaScript—no frameworks needed! [page:2] Users can browse products, filter by category, search, add to cart (with quantity controls), and checkout after login. [file content] Perfect for beginners learning modern DOM manipulation, CSS animations, local storage-free state management, and responsive design. By following along, you'll build a professional-looking shopping site with login system, cart logic, filters, search, and smooth animations. [page:2]

Prerequisites

  • Code editor: VS Code (or any HTML editor)
  • Browser: Chrome, Firefox, or Safari (for testing)
  • Basic knowledge: HTML structure, CSS (flexbox/grid), JavaScript (DOM, events, arrays)
  • No build tools needed - single HTML file!

Time to complete: 2-3 hours

Project Setup

No build tools or servers needed! This is a single HTML file that runs anywhere.

Quick Start (2 minutes)

  1. Create a new folder called EliteCommerce
  2. Save the code below as index.html
  3. Double-click index.html to open in your browser
  4. Start shopping! (Demo login: admin / admin123)

File Structure

EliteCommerce/ ├── index.html (all HTML + CSS + JS in one file!) └── README.md (this tutorial)

Run Commands

No terminal needed - just open the file! Windows: Double-click index.html Mac: Right-click > Open with Chrome Or drag index.html to any browser

✅ That's it! Your e-commerce site is live instantly.

Step-by-Step Building

Now let's build EliteCommerce from scratch! We'll break your single HTML file into logical parts.

Step 1: Project Structure & Basic HTML Skeleton

Create the basic folder and main HTML structure:

<title>EliteCommerce</title> ```

What this does: Sets up responsive viewport and clean document structure.

Step 2: Core Layout/UI (Header + Page Navigation) Add the header and page system:

⚡ EliteCommerce
Home Products 🛒 Cart 0 Login
Home hero content...
Products list...
Shopping cart...
Key concept: Use data-page attributes + CSS .page { display: none } + .active { display: block } for SPA-like navigation.

Step 3: Main Features (Products + Cart Logic) 3A: Products Array + Render Function const products = [ { id: 1, name: "Smart Watch Pro", price: 1999, emoji: "⌚", category: "electronics" } // ... more products ];

function renderProducts(productsToRender) { document.getElementById('productList').innerHTML = productsToRender .map(p => <div class="product-card"> <span class="product-emoji">${p.emoji}</span> <h3>${p.name}</h3> <div class="product-price">₹${p.price}</div> <button onclick="addToCart(${p.id})">Add to Cart</button> </div>).join(''); } 3B: Cart State + Add/Remove let cart = []; // Global state

function addToCart(productId) { const product = products.find(p => p.id === productId); const existing = cart.find(item => item.id === productId);

if (existing) { existing.quantity++; } else { cart.push({ ...product, quantity: 1 }); } updateCartBadge(); // Updates cart count in header } What this teaches: Array methods (map, find), template literals, state management without frameworks.

Step 4: Styling & Finishing Touches Add your CSS variables and key animations: :root { --primary: #0066ff; /* Blue theme / --dark: #0a0e27; / Dark background */ }

.product-card { background: var(--dark-card); border-radius: 20px; transition: all 0.4s ease; /* Smooth hover */ }

.product-card:hover { transform: translateY(-10px); /* Lift effect */ box-shadow: 0 15px 50px rgba(0,0,0,0.5); } Polish features:

Login modal (demo: admin/admin123)

Search + category filters

Toast notifications

Mobile-responsive hamburger menu

Your Action

  1. Copy this entire Step-by-Step section into your README.md
  2. Test: Does each step make sense standalone? Can a beginner follow?
  3. Reply "Steps section done" or ask about any step

Next: Usage & Demo (screenshots + how to use features). Ready?[1]

Usage & Demo

Quick Tour (2 minutes)

  1. Open index.html in your browser
  2. Login (top-right): admin / admin123 (required to shop)
  3. Browse Products page → Filter "Electronics" → Search "Watch"
  4. Add to Cart → Go to Cart → Adjust quantities (+/-) → Checkout!

Key Features Demo

  • 🛒 Shopping Flow: Browse → Add → Cart → Checkout (shows savings!)
  • 🔍 Search + Filters: Real-time product filtering by category
  • 📱 Fully Responsive: Works on mobile (tap ☰ menu)
  • ✨ Animations: Hover effects, floating emojis, toast notifications

Screenshots

(Add these - take in Chrome DevTools: Ctrl+Shift+P > "Capture screenshot")

  1. Hero Home - Eye-catching stats + CTA
  2. Products Grid - Cards with sale badges + hover lift
  3. Cart Page - Quantity controls + total calculator
  4. Mobile View - Collapsed nav + touch-friendly

Live Demo Flow

Home → Login → Products → Filter "Fashion" → Add Shoes + Headphones → Cart → +1 quantity → "Proceed to Checkout" → Success toast!

Conclusion & Next Steps

🎉 Congratulations! You've built a complete e-commerce site with vanilla HTML/CSS/JS. You now understand:

  • SPA navigation without frameworks
  • Real-time cart state management
  • Responsive design + CSS animations
  • DOM manipulation + event handling [page:2]

Level Up Your EliteCommerce (Try These!)

  1. Add Local Storage: Save cart/login state across browser refreshes

  2. More Products: Add 20+ items with images (use Unsplash CDN)

  3. Search Improvements: Add product images + fuzzy search

  4. Backend Integration: Connect to JSONPlaceholder API for real products

  5. Deployment: Host free on GitHub Pages or Netlify (1-click deploy)

  6. PWA: Add service worker for offline shopping

Contribute to Open Source!

Add this to practical-tutorials/project-based-learning:

Your e-commerce skills are now production-ready! 🚀 [page:2]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 47.7%
  • JavaScript 38.1%
  • HTML 14.2%