Below, I'll help you create a basic template for an e-commerce website inspired by thebeerstore.ca. This site is a Canadian online store for beer and related products, featuring elements like product browsing, shopping carts, age verification, and user accounts. I'll provide a simple, customizable HTML/CSS template as a starting point. This isn't a fully functional site (you'll need backend integration for features like payments and databases), but it gives you a solid structure.
Key Features Inspired by thebeerstore.ca:
- Age Verification: A modal or page to confirm the user is of legal drinking age.
- Product Catalog: Grid-based display of products with images, descriptions, and prices.
- Navigation: Easy access to categories (e.g., beer types, brands), search, and cart.
- Responsive Design: Ensures the site works on mobile and desktop.
- Shopping Cart: Basic add-to-cart functionality (using JavaScript).
- Footer and Header: Standard e-commerce layout with links to policies and contact info.
I'll use:
- HTML5 for structure.
- CSS3 (with Flexbox for layout) for styling.
- A bit of JavaScript for simple interactions like showing/hiding the age gate or updating the cart.
Step 1: Set Up Your Project
- Create a new folder for your project.
- Inside it, make three files:
index.html, styles.css, and script.js.
- Link them in your HTML file.
Step 2: HTML Template
Here's a basic HTML structure. I've included comments to explain each section.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Beer Store Template</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!-- Age Verification Modal (Pop up on page load) -->
<div id="age-gate" class="modal">
<div class="modal-content">
<h2>Age Verification</h2>
<p>Are you 19 years or older? You must be of legal drinking age to enter this site.</p>
<button id="yes-btn">Yes, I am 19+</button>
<button id="no-btn">No, I'm under 19</button>
</div>
</div>
<!-- Header Section -->
<header>
<div class="logo">
<h1>The Beer Store</h1>
</div>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Categories</a></li> <!-- e.g., Lagers, Ales, Brands -->
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Cart</a></li> <!-- Link to shopping cart -->
</ul>
<div class="search-bar">
<input type="text" placeholder="Search products...">
<button>Search</button>
</div>
</nav>
</header>
<!-- Hero Section (Promotions or Featured Products) -->
<section class="hero">
<h2>Discover Your Favorite Beers</h2>
<p>Shop from a wide selection of craft and premium beers. Limited-time offers!</p>
<button>Shop Now</button>
</section>
<!-- Product Catalog Section -->
<section class="products">
<h2>Featured Products</h2>
<div class="product-grid">
<!-- Example Product Cards -->
<div class="product-card">
<img src="placeholder-image.jpg" alt="Beer Product">
<h3>Product Name 1</h3>
<p>Description: A crisp lager with fruity notes.</p>
<p>Price: $10.99</p>
<button class="add-to-cart">Add to Cart</button>
</div>
<div class="product-card">
<img src="placeholder-image.jpg" alt="Beer Product">
<h3>Product Name 2</h3>
<p>Description: Bold IPA with hoppy flavors.</p>
<p>Price: $12.50</p>
<button class="add-to-cart">Add to Cart</button>
</div>
<!-- Add more product cards as needed -->
</div>
</section>
<!-- Shopping Cart Section (Simple overlay or sidebar) -->
<section id="cart" class="cart">
<h2>Shopping Cart</h2>
<ul id="cart-items">
<!-- Dynamically populated via JavaScript -->
<li>Item 1 - $10.99</li>
</ul>
<p>Total: $0.00</p>
<button>Checkout</button>
</section>
<!-- Footer Section -->
<footer>
<p>© 2023 The Beer Store. All rights reserved.</p>
<ul>
<li><a href="#">Privacy Policy</a></li>
<li><a href="#">Terms of Service</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
<div class="social-media">
<a href="#">Facebook</a>
<a href="#">Twitter</a>
<a href="#">Instagram</a>
</div>
</footer>
<script src="script.js"></script>
</body>
</html>
Step 3: CSS Styling (styles.css)
This will make your template look modern and responsive. Copy this into your styles.css file.
/* Basic Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
line-height: 1.6;
}
/* Modal for Age Gate */
.modal {
display: none; /* Hidden by default */
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
justify-content: center;
align-items: center;
}
.modal-content {
background: white;
padding: 20px;
border-radius: 8px;
text-align: center;
}
header {
background: #333;
color: white;
padding: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}
header nav ul {
list-style: none;
display: flex;
}
header nav ul li {
margin: 0 1rem;
}
header nav ul li a {
color: white;
text-decoration: none;
}
.search-bar {
margin-left: 1rem;
}
.hero {
background: #f4f4f4;
text-align: center;
padding: 4rem 2rem;
}
.products {
padding: 2rem;
}
.product-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
}
.product-card {
border: 1px solid #ddd;
padding: 1rem;
text-align: center;
}
.product-card img {
max-width: 100%;
height: auto;
}
.cart {
position: fixed;
right: 0;
top: 100px;
background: white;
border: 1px solid #ddd;
padding: 1rem;
width: 300px;
display: none; /* Hidden by default */
}
footer {
background: #333;
color: white;
text-align: center;
padding: 1rem;
margin-top: 2rem;
}
footer ul {
list-style: none;
display: flex;
justify-content: center;
}
footer ul li {
margin: 0 1rem;
}
/* Responsive Design */
@media (max-width: 768px) {
header {
flex-direction: column;
}
header nav ul {
flex-direction: column;
margin-top: 1rem;
}
}
Step 4: JavaScript for Interactivity (script.js)
This adds basic functionality, like showing the age gate on load and handling the cart. Copy this into your script.js file.
// Age Gate Modal
document.addEventListener('DOMContentLoaded', () => {
const ageGate = document.getElementById('age-gate');
const yesBtn = document.getElementById('yes-btn');
const noBtn = document.getElementById('no-btn');
ageGate.style.display = 'flex'; // Show modal on page load
yesBtn.addEventListener('click', () => {
ageGate.style.display = 'none'; // Hide if user confirms age
});
noBtn.addEventListener('click', () => {
window.location.href = 'https://www.example.com/underage'; // Redirect or show message
});
// Simple Cart Functionality
const addToCartButtons = document.querySelectorAll('.add-to-cart');
const cartItems = document.getElementById('cart-items');
const cartSection = document.getElementById('cart');
let cartTotal = 0;
addToCartButtons.forEach(button => {
button.addEventListener('click', () => {
const productCard = button.parentElement;
const productName = productCard.querySelector('h3').textContent;
const productPrice = parseFloat(productCard.querySelector('p:nth-of-type(2)').textContent.replace('$', ''));
const listItem = document.createElement('li');
listItem.textContent = `${productName} - $${productPrice.toFixed(2)}`;
cartItems.appendChild(listItem);
cartTotal += productPrice;
document.querySelector('.cart p:last-of-type').textContent = `Total: $${cartTotal.toFixed(2)}`;
cartSection.style.display = 'block'; // Show cart
});
});
});
How to Customize and Enhance:
- Replace Placeholders: Swap out placeholder images, product names, and descriptions with your actual content.
- Add Functionality:
- Integrate a backend (e.g., using Node.js, WooCommerce, or Shopify) for real shopping carts, user logins, and payments.
- Use a framework like Bootstrap or Tailwind CSS for faster styling.
- Add filters to the product grid (e.g., via JavaScript for categories).
- Age Verification: In a real site, this should use geolocation and legal checks (e.g., via API).
- Testing: Open
index.html in a browser to see it in action. Test on mobile devices for responsiveness.
- Legal Considerations: If you're selling alcohol, ensure compliance with laws (e.g., age gates, shipping restrictions).
This template is a starting point. For a more advanced setup, consider using WordPress with WooCommerce or a custom framework like React. If you need help with specific modifications, let me know!