HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<!-- Header -->
<header>
<div class="container header-container">
<div class="flex items-center space-x-10">
<a href="/" class="logo">WPDean</a>
<nav class="nav-links">
<a href="/home" class="nav-link active">Home</a>
<a href="/men" class="nav-link">Men</a>
<a href="/women" class="nav-link">Women</a>
<a href="/kids" class="nav-link">Kids</a>
</nav>
</div>
<div class="icons">
<button class="icon-btn">
<i class="fas fa-search"></i>
</button>
<button class="icon-btn">
<i class="fas fa-bell"></i>
</button>
<button class="icon-btn">
<i class="fas fa-heart"></i>
</button>
<button class="icon-btn" id="cart-button">
<i class="fas fa-shopping-cart"></i>
</button>
<div class="user-icon">
<i class="fas fa-user"></i>
</div>
</div>
</div>
</header>
<!-- Main content -->
<main class="container">
<!-- Breadcrumb -->
<nav class="breadcrumb">
<a href="/">Home</a>
<span class="breadcrumb-separator">
<i class="fas fa-chevron-right"></i>
</span>
<a href="/products">Products</a>
<span class="breadcrumb-separator">
<i class="fas fa-chevron-right"></i>
</span>
<a href="/products/sweatshirts">sweatshirts</a>
<span class="breadcrumb-separator">
<i class="fas fa-chevron-right"></i>
</span>
<span class="current-page">Classic Comfort Sweatshirt</span>
</nav>
<!-- Product layout -->
<div class="product-layout">
<!-- Product images -->
<div class="product-images">
<div class="main-image">
<img src="https://images.unsplash.com/photo-1490730141103-6cac27aaab94?w=600&auto=format&fit=crop&q=60" alt="Classic Comfort Sweatshirt - main image" id="main-product-image">
</div>
<div class="image-thumbnails">
<button class="thumbnail-btn active" data-image="https://images.unsplash.com/photo-1490730141103-6cac27aaab94?w=600&auto=format&fit=crop&q=60">
<img src="https://images.unsplash.com/photo-1490730141103-6cac27aaab94?w=600&auto=format&fit=crop&q=60" alt="Classic Comfort Sweatshirt - view 1">
</button>
<button class="thumbnail-btn" data-image="https://images.unsplash.com/photo-1542281286-9e0a16bb7366?w=600&auto=format&fit=crop&q=60">
<img src="https://images.unsplash.com/photo-1542281286-9e0a16bb7366?w=600&auto=format&fit=crop&q=60" alt="Classic Comfort Sweatshirt - view 2">
</button>
<button class="thumbnail-btn" data-image="https://images.unsplash.com/photo-1476820865390-c52aeebb9891?w=600&auto=format&fit=crop&q=60">
<img src="https://images.unsplash.com/photo-1476820865390-c52aeebb9891?w=600&auto=format&fit=crop&q=60" alt="Classic Comfort Sweatshirt - view 3">
</button>
<button class="thumbnail-btn" data-image="https://images.unsplash.com/photo-1556821840-3a63f95609a7?w=600&auto=format&fit=crop&q=60">
<img src="https://images.unsplash.com/photo-1556821840-3a63f95609a7?w=600&auto=format&fit=crop&q=60" alt="Classic Comfort Sweatshirt - view 4">
</button>
<button class="thumbnail-btn" data-image="https://images.unsplash.com/photo-1519681393784-d120267933ba?w=600&auto=format&fit=crop&q=60">
<img src="https://images.unsplash.com/photo-1519681393784-d120267933ba?w=600&auto=format&fit=crop&q=60" alt="Classic Comfort Sweatshirt - view 5">
</button>
</div>
</div>
<!-- Product details -->
<div class="product-details">
<h1 class="product-title">Classic Comfort Sweatshirt</h1>
<div class="rating">
<div class="stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<span class="reviews-count">(243 reviews)</span>
</div>
<p class="product-description">A comfy collection, perfect for casual everyday wear.</p>
<div class="product-price">
<span class="current-price">$79.99</span>
<span class="original-price">$95.00</span>
</div>
<!-- Color selector -->
<div class="color-selector">
<div class="option-label">Color: <span id="selected-color">Sage Green</span></div>
<div class="color-options">
<button class="color-option selected" data-color-name="Sage Green">
<span class="color-swatch" style="background-color: #97a98f;"></span>
</button>
<button class="color-option" data-color-name="Soft Beige">
<span class="color-swatch" style="background-color: #f1deca;"></span>
</button>
<button class="color-option" data-color-name="Light Blue">
<span class="color-swatch" style="background-color: #b7c4cf;"></span>
</button>
</div>
</div>
<!-- Size selector -->
<div class="size-selector">
<div class="option-label">Size: <span id="selected-size">S</span></div>
<div class="size-options">
<button class="size-option" data-size="XS">XS</button>
<button class="size-option selected" data-size="S">S</button>
<button class="size-option" data-size="M">M</button>
<button class="size-option" data-size="L">L</button>
<button class="size-option" data-size="XL">XL</button>
<button class="size-option" data-size="XXL">XXL</button>
</div>
</div>
<!-- Action buttons -->
<div class="actions">
<button class="btn btn-primary" id="add-to-cart">Add to Cart</button>
<button class="btn btn-outline">Buy Now</button>
</div>
<!-- Product actions -->
<div class="product-actions">
<button class="action-btn">
<i class="fas fa-heart"></i>
<span>Save</span>
</button>
<div class="divider"></div>
<button class="action-btn">
<i class="fas fa-share-alt"></i>
<span>Share</span>
</button>
</div>
<!-- Shipping info -->
<div class="shipping-info">
<h4 class="shipping-title">Shipping</h4>
<p class="shipping-text">Free shipping on orders over $50</p>
<p class="shipping-text">Estimated delivery: 3-5 business days</p>
</div>
</div>
</div>
<!-- Tabs -->
<div class="tabs">
<div class="tab-buttons">
<button class="tab-btn active" data-tab="details">Details</button>
<button class="tab-btn" data-tab="reviews">Reviews</button>
<button class="tab-btn" data-tab="questions">Questions</button>
</div>
<div class="tab-content">
<!-- Details tab -->
<div class="tab-pane active" id="details-tab">
<div class="max-w-3xl">
<p>This collection features a simple and comfortable design in a vintage style look. We feature family-focused styles made with soft fabric that's perfect for everyday wear. The sweatshirt is made from a blend of organic cotton and recycled polyester, providing both comfort and sustainability.</p>
<div class="mt-4">
<h3 class="font-medium mb-2">Features:</h3>
<ul class="list-disc pl-5 space-y-1">
<li>Made with 80% organic cotton and 20% recycled polyester</li>
<li>Ribbed cuffs and hem</li>
<li>Regular fit</li>
<li>Machine washable</li>
<li>Imported</li>
</ul>
</div>
</div>
</div>
<!-- Reviews tab -->
<div class="tab-pane" id="reviews-tab">
<div class="reviews-container">
<div class="reviews-summary">
<div class="reviews-card">
<div class="average-rating">4.9</div>
<div class="reviews-stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<div class="total-reviews">243 reviews</div>
<div class="rating-bars">
<div class="rating-bar">
<div class="star-label">5 ★</div>
<div class="bar-container">
<div class="bar-fill" style="width: 76%"></div>
</div>
<div class="bar-count">184</div>
</div>
<div class="rating-bar">
<div class="star-label">4 ★</div>
<div class="bar-container">
<div class="bar-fill" style="width: 18%"></div>
</div>
<div class="bar-count">43</div>
</div>
<div class="rating-bar">
<div class="star-label">3 ★</div>
<div class="bar-container">
<div class="bar-fill" style="width: 12%"></div>
</div>
<div class="bar-count">29</div>
</div>
<div class="rating-bar">
<div class="star-label">2 ★</div>
<div class="bar-container">
<div class="bar-fill" style="width: 2%"></div>
</div>
<div class="bar-count">5</div>
</div>
<div class="rating-bar">
<div class="star-label">1 ★</div>
<div class="bar-container">
<div class="bar-fill" style="width: 1%"></div>
</div>
<div class="bar-count">2</div>
</div>
</div>
</div>
<div class="write-review">
<button class="btn btn-outline" style="width: 100%">Write a Review</button>
</div>
</div>
<div class="reviews-list">
<div class="reviews-header">
<h3 class="reviews-title">Customer Reviews</h3>
<select class="sort-select">
<option>Most Recent</option>
<option>Highest Rating</option>
<option>Lowest Rating</option>
</select>
</div>
<!-- Review items -->
<div class="review-item">
<div class="review-header">
<img class="reviewer-avatar" src="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100&auto=format&fit=crop&q=60" alt="James Donner's profile">
<div class="reviewer-info">
<h4 class="reviewer-name">James Donner</h4>
<div class="reviewer-stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
</div>
</div>
<div class="review-content">
A simple classic look but makes this outfit seem real and beautiful, the material is soft, but when worn it often wrinkles because of sitting for too long.
</div>
<div class="review-actions">
<button class="review-action">
<i class="fas fa-thumbs-up"></i>
<span>8</span>
</button>
<button class="review-action">
<i class="fas fa-comment"></i>
<span>2</span>
</button>
<span class="review-date">March 15, 2025</span>
</div>
</div>
<div class="review-item">
<div class="review-header">
<img class="reviewer-avatar" src="https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?w=100&auto=format&fit=crop&q=60" alt="Ray Hawkins's profile">
<div class="reviewer-info">
<h4 class="reviewer-name">Ray Hawkins</h4>
<div class="reviewer-stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
</div>
</div>
<div class="review-content">
Great classic style like promised and the fitting is just right!
</div>
<div class="review-actions">
<button class="review-action">
<i class="fas fa-thumbs-up"></i>
<span>2</span>
</button>
<button class="review-action">
<i class="fas fa-comment"></i>
<span>0</span>
</button>
<span class="review-date">February 2, 2025</span>
</div>
</div>
<div class="review-item">
<div class="review-header">
<img class="reviewer-avatar" src="https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=100&auto=format&fit=crop&q=60" alt="Brooklyn Simmons's profile">
<div class="reviewer-info">
<h4 class="reviewer-name">Brooklyn Simmons</h4>
<div class="reviewer-stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
</div>
</div>
<div class="review-content">
Love the material, it's so comfortable. Bought two pcs.
</div>
<div class="review-actions">
<button class="review-action">
<i class="fas fa-thumbs-up"></i>
<span>1</span>
</button>
<button class="review-action">
<i class="fas fa-comment"></i>
<span>0</span>
</button>
<span class="review-date">January 18, 2025</span>
</div>
</div>
<div class="text-center" style="margin-top: 1.5rem;">
<button class="btn btn-outline">Load More Reviews</button>
</div>
</div>
</div>
</div>
<!-- Questions tab -->
<div class="tab-pane" id="questions-tab">
<div style="text-align: center; padding: 2rem 0;">
<i class="fas fa-comment fa-3x" style="color: #e5e7eb; margin-bottom: 1rem;"></i>
<h3 style="font-size: 1.125rem; font-weight: 500; margin-bottom: 0.5rem;">Have questions about this product?</h3>
<p style="color: #6b7280; margin-bottom: 1rem;">Ask the community or share your knowledge</p>
<button class="btn btn-outline">Ask a Question</button>
</div>
</div>
</div>
</div>
<!-- Related products -->
<section class="related-products">
<h2 class="section-title">You May Also Like</h2>
<div class="products-grid">
<!-- Product 1 -->
<div class="product-card">
<div class="new-tag">New Arrivals</div>
<div class="product-card-image">
<img src="https://images.unsplash.com/photo-1543076447-215ad9ba6923?w=400&auto=format&fit=crop&q=60" alt="V-Neck Soft Knit Sweater">
<button class="product-card-wishlist">
<i class="fas fa-heart"></i>
</button>
</div>
<h3 class="product-card-name">V-Neck Soft Knit Sweater</h3>
<div class="product-card-rating">
<div class="product-card-stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<span class="product-card-review-count">(170)</span>
</div>
<div class="product-card-price">
<span class="product-card-current-price">$69.99</span>
</div>
</div>
<!-- Product 2 -->
<div class="product-card">
<div class="product-card-image">
<img src="https://images.unsplash.com/photo-1518622358385-8ea7d0794bf6?w=400&auto=format&fit=crop&q=60" alt="Dolman T-Shirt">
<button class="product-card-wishlist">
<i class="fas fa-heart"></i>
</button>
</div>
<h3 class="product-card-name">Dolman T-Shirt</h3>
<div class="product-card-rating">
<div class="product-card-stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<span class="product-card-review-count">(220)</span>
</div>
<div class="product-card-price">
<span class="product-card-current-price">$79.99</span>
<span class="product-card-original-price">$99.99</span>
</div>
</div>
<!-- Product 3 -->
<div class="product-card">
<div class="product-card-image">
<img src="https://images.unsplash.com/photo-1578587018452-892bacefd3f2?w=400&auto=format&fit=crop&q=60" alt="Long Sleeve Sweater">
<button class="product-card-wishlist">
<i class="fas fa-heart"></i>
</button>
</div>
<h3 class="product-card-name">Long Sleeve Sweater</h3>
<div class="product-card-rating">
<div class="product-card-stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<span class="product-card-review-count">(270)</span>
</div>
<div class="product-card-price">
<span class="product-card-current-price">$89.99</span>
</div>
</div>
<!-- Product 4 -->
<div class="product-card">
<div class="product-card-image">
<img src="https://images.unsplash.com/photo-1581655353564-df123a1eb820?w=400&auto=format&fit=crop&q=60" alt="Vintage Sweatshirt">
<button class="product-card-wishlist">
<i class="fas fa-heart"></i>
</button>
</div>
<h3 class="product-card-name">Vintage Sweatshirt</h3>
<div class="product-card-rating">
<div class="product-card-stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<span class="product-card-review-count">(320)</span>
</div>
<div class="product-card-price">
<span class="product-card-current-price">$99.99</span>
<span class="product-card-original-price">$119.99</span>
</div>
</div>
</div>
</section>
</main>
<!-- Sticky cart -->
<div class="sticky-cart">
<div class="sticky-cart-container">
<div class="cart-preview">
<button class="cart-btn" id="open-cart">
<i class="fas fa-shopping-cart"></i>
<span class="cart-count">1</span>
</button>
<span class="cart-items">1 item</span>
</div>
<div class="cart-summary">
<div>
<span class="cart-total-label">Total:</span>
<div class="cart-total-price">$79.99</div>
</div>
<button class="btn btn-primary">Checkout</button>
</div>
</div>
</div>
<!-- Cart drawer -->
<div class="drawer-backdrop" id="drawer-backdrop"></div>
<div class="drawer" id="cart-drawer">
<div class="drawer-header">
<h3 class="drawer-title">Your Cart</h3>
</div>
<div class="drawer-content">
<div class="cart-item">
<div class="cart-item-info">
<div class="cart-item-image">
<img src="https://images.unsplash.com/photo-1572495175742-35d0f10406f6?w=600&auto=format&fit=crop&q=60" alt="Classic Comfort Sweatshirt">
</div>
<div>
<h4>Classic Comfort Sweatshirt</h4>
<p class="cart-item-meta">Size: S | Color: Sage</p>
<p class="cart-item-price">$79.99</p>
</div>
</div>
<div class="cart-item-actions">
<button class="remove-btn">
<i class="fas fa-times"></i>
</button>
<div class="quantity-controls">
<button class="qty-btn qty-minus">
<i class="fas fa-minus"></i>
</button>
<span class="qty-display">1</span>
<button class="qty-btn qty-plus">
<i class="fas fa-plus"></i>
</button>
</div>
</div>
</div>
<div class="cart-summary-section">
<span class="summary-label">Subtotal</span>
<span class="summary-value" id="cart-subtotal">$79.99</span>
</div>
<button class="btn btn-primary" style="width: 100%;">Checkout</button>
</div>
</div>
<!-- Footer -->
<footer>
<div class="container">
<div class="footer-content">
<div class="footer-brand">
<h2>WPDean</h2>
<p>Online brand created founded in 2008 in Japan. Heavily focuses on selling cozy, quality, and branded items, limited edition collectibles by local fashion designer.</p>
</div>
<div class="footer-links">
<h3>About Us</h3>
<ul>
<li><a href="/information" class="footer-link">Information</a></li>
<li><a href="/store-locator" class="footer-link">Store Locator</a></li>
<li><a href="/bulk-purchase" class="footer-link">Bulk Purchase</a></li>
<li><a href="/alteration" class="footer-link">Alteration Service</a></li>
<li><a href="/gift-delivery" class="footer-link">Gift Delivery Service</a></li>
</ul>
</div>
<div class="footer-links">
<h3>Help</h3>
<ul>
<li><a href="/faq" class="footer-link">FAQ</a></li>
<li><a href="/shopping-guide" class="footer-link">Online Shopping Guide</a></li>
<li><a href="/return-policy" class="footer-link">Return Policy</a></li>
<li><a href="/privacy" class="footer-link">Privacy Policy</a></li>
<li><a href="/accessibility" class="footer-link">Accessibility</a></li>
<li><a href="/contact" class="footer-link">Contact Us</a></li>
</ul>
</div>
<div class="footer-links">
<h3>Account</h3>
<ul>
<li><a href="/membership" class="footer-link">Membership</a></li>
<li><a href="/profile" class="footer-link">Profile</a></li>
<li><a href="/coupons" class="footer-link">Coupons</a></li>
</ul>
<h3 style="margin-top: 1.5rem;">Social Media</h3>
<div class="social-icons">
<a href="#" class="social-link"><i class="fab fa-twitter"></i></a>
<a href="#" class="social-link"><i class="fab fa-facebook-f"></i></a>
<a href="#" class="social-link"><i class="fab fa-instagram"></i></a>
<a href="#" class="social-link"><i class="fab fa-youtube"></i></a>
</div>
</div>
</div>
<div class="footer-bottom">
<p class="copyright">©WPDean 2025. All rights reserved.</p>
<div class="footer-meta">
<a href="/privacy" class="meta-link">Privacy Policy</a>
<span class="separator">|</span>
<a href="/terms" class="meta-link">Terms and Conditions</a>
</div>
</div>
</div>
</footer>
</body>
/* Reset and base styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.5;
color: #333;
background-color: #fff;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 1rem;
}
/* Header styles */
header {
background-color: #fff;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
position: sticky;
top: 0;
z-index: 50;
border-bottom: 1px solid #e5e7eb;
}
.header-container {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
}
.logo {
color: #1e40af;
font-weight: bold;
font-size: 1.5rem;
text-decoration: none;
}
.nav {
display: flex;
align-items: center;
}
.nav-links {
display: none;
}
@media (min-width: 768px) {
.nav-links {
display: flex;
gap: 1.5rem;
margin-left: 2.5rem;
}
}
.nav-link {
color: #4b5563;
text-decoration: none;
padding: 0.25rem 0;
transition: color 0.2s;
font-size: 0.875rem;
}
.nav-link:hover {
color: #1e40af;
}
.nav-link.active {
color: #1e40af;
border-bottom: 2px solid #1e40af;
}
.icons {
display: flex;
align-items: center;
gap: 1rem;
}
.icon-btn {
background: none;
border: none;
cursor: pointer;
color: #6b7280;
padding: 0.5rem;
transition: color 0.2s;
}
.icon-btn:hover {
color: #4b5563;
}
.user-icon {
background-color: #1e40af;
color: white;
width: 2rem;
height: 2rem;
border-radius: 9999px;
display: flex;
align-items: center;
justify-content: center;
}
/* Breadcrumb styles */
.breadcrumb {
display: flex;
align-items: center;
padding: 0.75rem 0;
font-size: 0.875rem;
color: #6b7280;
}
.breadcrumb a {
color: #6b7280;
text-decoration: none;
}
.breadcrumb a:hover {
color: #4b5563;
}
.breadcrumb-separator {
margin: 0 0.25rem;
}
.current-page {
font-weight: 500;
color: #111827;
}
/* Product layout */
.product-layout {
display: flex;
flex-direction: column;
gap: 2rem;
margin-top: 1rem;
margin-bottom: 2rem;
}
@media (min-width: 1024px) {
.product-layout {
flex-direction: row;
}
.product-images {
width: 50%;
}
.product-details {
width: 50%;
}
}
/* Product images */
.product-images {
position: relative;
}
.main-image {
aspect-ratio: 1;
overflow: hidden;
border-radius: 0.375rem;
margin-bottom: 1rem;
}
.main-image img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.image-thumbnails {
display: flex;
gap: 0.5rem;
overflow-x: auto;
padding-bottom: 0.5rem;
}
.thumbnail-btn {
width: 6rem;
height: 6rem;
border: 2px solid transparent;
border-radius: 0.25rem;
overflow: hidden;
cursor: pointer;
flex-shrink: 0;
}
.thumbnail-btn.active {
border-color: #1e40af;
}
.thumbnail-btn img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* Product details */
.product-title {
font-size: 1.5rem;
font-weight: 700;
color: #111827;
margin-bottom: 0.5rem;
}
@media (min-width: 768px) {
.product-title {
font-size: 1.875rem;
}
}
.rating {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1rem;
}
.stars {
display: flex;
color: #ffb800;
}
.reviews-count {
color: #6b7280;
font-size: 0.875rem;
}
.product-description {
color: #4b5563;
margin-bottom: 1rem;
}
.product-price {
display: flex;
align-items: baseline;
margin-top: 1.5rem;
}
.current-price {
font-size: 1.5rem;
font-weight: 700;
color: #111827;
}
.original-price {
margin-left: 0.75rem;
color: #6b7280;
text-decoration: line-through;
}
/* Color selector */
.color-selector {
margin-top: 1.5rem;
}
.option-label {
font-size: 0.875rem;
font-weight: 500;
color: #374151;
margin-bottom: 0.5rem;
}
.color-options {
display: flex;
gap: 0.5rem;
}
.color-option {
width: 2.5rem;
height: 2.5rem;
border: 2px solid #e5e7eb;
border-radius: 0.25rem;
cursor: pointer;
padding: 2px;
}
.color-option.selected {
border-color: #374151;
}
.color-swatch {
width: 100%;
height: 100%;
border-radius: 0.125rem;
}
/* Size selector */
.size-selector {
margin-top: 1.5rem;
}
.size-options {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 0.5rem;
margin-top: 0.5rem;
}
.size-option {
display: flex;
justify-content: center;
align-items: center;
padding: 0.5rem;
border: 1px solid #e5e7eb;
border-radius: 0.375rem;
font-size: 0.875rem;
color: #374151;
cursor: pointer;
background: none;
transition: all 0.2s;
}
.size-option:hover {
background-color: #f3f4f6;
}
.size-option.selected {
background-color: #1e40af;
color: white;
border-color: #1e40af;
}
/* Action buttons */
.actions {
margin-top: 2rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.btn {
display: flex;
justify-content: center;
align-items: center;
padding: 0.75rem 1rem;
border-radius: 0.375rem;
font-weight: 500;
transition: all 0.2s;
border: none;
cursor: pointer;
}
.btn-primary {
background-color: #1e40af;
color: white;
}
.btn-primary:hover {
background-color: #1e3a8a;
}
.btn-outline {
background-color: white;
border: 1px solid #d1d5db;
color: #374151;
}
.btn-outline:hover {
background-color: #f3f4f6;
}
/* Product actions */
.product-actions {
display: flex;
justify-content: space-around;
padding: 0.75rem 0;
margin-top: 1.5rem;
border-top: 1px solid #e5e7eb;
border-bottom: 1px solid #e5e7eb;
}
.action-btn {
display: flex;
align-items: center;
color: #6b7280;
background: none;
border: none;
font-size: 0.875rem;
cursor: pointer;
}
.action-btn:hover {
color: #1e40af;
}
.action-btn i {
margin-right: 0.5rem;
}
.divider {
width: 1px;
background-color: #e5e7eb;
}
/* Shipping info */
.shipping-info {
margin-top: 1.5rem;
padding: 1rem;
background-color: #f9fafb;
border: 1px solid #e5e7eb;
border-radius: 0.375rem;
}
.shipping-title {
font-weight: 500;
margin-bottom: 0.5rem;
}
.shipping-text {
font-size: 0.875rem;
color: #4b5563;
}
/* Tabs */
.tabs {
margin-top: 3rem;
}
.tab-buttons {
display: flex;
border-bottom: 1px solid #e5e7eb;
}
.tab-btn {
padding: 0.75rem 1rem;
font-size: 0.875rem;
font-weight: 500;
color: #6b7280;
background: none;
border: none;
border-bottom: 2px solid transparent;
cursor: pointer;
}
.tab-btn.active {
color: #1e40af;
border-bottom-color: #1e40af;
}
.tab-content {
padding: 1rem 0;
}
.tab-pane {
display: none;
}
.tab-pane.active {
display: block;
}
/* Reviews section */
.reviews-container {
display: flex;
flex-direction: column;
}
@media (min-width: 768px) {
.reviews-container {
flex-direction: row;
gap: 2rem;
}
.reviews-summary {
width: 33.333333%;
}
.reviews-list {
width: 66.666667%;
}
}
.reviews-card {
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
padding: 1.5rem;
}
.average-rating {
font-size: 2.25rem;
font-weight: 700;
text-align: center;
}
.reviews-stars {
display: flex;
justify-content: center;
margin: 0.5rem 0;
}
.total-reviews {
text-align: center;
font-size: 0.875rem;
color: #6b7280;
margin-bottom: 1.5rem;
}
.rating-bars {
margin-top: 1rem;
}
.rating-bar {
display: flex;
align-items: center;
margin-bottom: 0.25rem;
}
.star-label {
width: 2rem;
font-size: 0.75rem;
color: #6b7280;
}
.bar-container {
flex-grow: 1;
height: 0.5rem;
background-color: #e5e7eb;
border-radius: 9999px;
margin: 0 0.5rem;
}
.bar-fill {
height: 100%;
background-color: #ffb800;
border-radius: 9999px;
}
.bar-count {
width: 3rem;
font-size: 0.75rem;
color: #6b7280;
}
.write-review {
margin-top: 1.5rem;
}
.reviews-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.reviews-title {
font-size: 1.125rem;
font-weight: 500;
}
.sort-select {
padding: 0.25rem 0.5rem;
font-size: 0.875rem;
border: 1px solid #e5e7eb;
border-radius: 0.25rem;
}
/* Review item */
.review-item {
padding: 1.5rem 0;
border-bottom: 1px solid #e5e7eb;
}
.review-header {
display: flex;
margin-bottom: 0.5rem;
}
.reviewer-avatar {
width: 2.5rem;
height: 2.5rem;
border-radius: 9999px;
object-fit: cover;
margin-right: 0.75rem;
}
.reviewer-info {
flex-grow: 1;
}
.reviewer-name {
font-size: 0.875rem;
font-weight: 500;
}
.reviewer-stars {
display: flex;
}
.reviewer-stars i {
font-size: 0.875rem;
}
.review-content {
margin: 0.75rem 0;
font-size: 0.875rem;
color: #374151;
}
.review-actions {
display: flex;
align-items: center;
font-size: 0.75rem;
color: #6b7280;
}
.review-action {
display: flex;
align-items: center;
margin-right: 1rem;
}
.review-action i {
margin-right: 0.25rem;
}
.review-date {
margin-left: auto;
}
/* Related products */
.related-products {
margin-top: 4rem;
}
.section-title {
font-size: 1.5rem;
font-weight: 700;
margin-bottom: 1.5rem;
}
.products-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem;
}
@media (min-width: 768px) {
.products-grid {
grid-template-columns: repeat(4, 1fr);
}
}
/* Product card */
.product-card {
position: relative;
}
.product-card-image {
position: relative;
aspect-ratio: 1;
overflow: hidden;
border-radius: 0.375rem;
background-color: #f3f4f6;
margin-bottom: 0.75rem;
}
.product-card-image img {
width: 100%;
height: 100%;
object-fit: cover;
transition: opacity 0.2s;
}
.product-card-image:hover img {
opacity: 0.9;
}
.product-card-wishlist {
position: absolute;
top: 0.5rem;
right: 0.5rem;
width: 2rem;
height: 2rem;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(255, 255, 255, 0.8);
border-radius: 9999px;
color: #6b7280;
}
.new-tag {
position: absolute;
top: 0.5rem;
left: 0.5rem;
background-color: #000;
color: white;
font-size: 0.75rem;
padding: 0.25rem 0.5rem;
z-index: 10;
}
.product-card-name {
font-size: 0.875rem;
font-weight: 500;
color: #111827;
margin-bottom: 0.25rem;
}
.product-card-rating {
display: flex;
align-items: center;
margin-top: 0.25rem;
}
.product-card-stars {
display: flex;
color: #ffb800;
font-size: 0.75rem;
}
.product-card-review-count {
margin-left: 0.25rem;
font-size: 0.75rem;
color: #6b7280;
}
.product-card-price {
display: flex;
align-items: center;
margin-top: 0.25rem;
}
.product-card-current-price {
font-weight: 500;
color: #111827;
}
.product-card-original-price {
margin-left: 0.5rem;
font-size: 0.875rem;
color: #6b7280;
text-decoration: line-through;
}
/* Sticky cart */
.sticky-cart {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 50;
background-color: white;
padding: 0.5rem;
border-top: 1px solid #e5e7eb;
box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.1);
}
.sticky-cart-container {
max-width: 1200px;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
}
.cart-preview {
display: flex;
align-items: center;
gap: 0.75rem;
}
.cart-btn {
position: relative;
background: none;
border: none;
padding: 0.5rem;
cursor: pointer;
}
.cart-count {
position: absolute;
top: -0.25rem;
right: -0.25rem;
background-color: #1e40af;
color: white;
font-size: 0.75rem;
width: 1.25rem;
height: 1.25rem;
border-radius: 9999px;
display: flex;
align-items: center;
justify-content: center;
}
.cart-items {
font-size: 0.875rem;
font-weight: 500;
}
.cart-summary {
display: flex;
align-items: center;
gap: 1rem;
}
.cart-total-label {
font-size: 0.875rem;
color: #6b7280;
}
.cart-total-price {
font-weight: 600;
}
/* Cart drawer */
.drawer-backdrop {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
z-index: 100;
display: none;
}
.drawer {
position: fixed;
top: 0;
right: -100%;
bottom: 0;
width: 100%;
max-width: 28rem;
background-color: white;
z-index: 101;
transition: right 0.3s ease-in-out;
overflow-y: auto;
}
.drawer.open {
right: 0;
}
.drawer-header {
padding: 1rem;
border-bottom: 1px solid #e5e7eb;
}
.drawer-title {
font-size: 1.125rem;
font-weight: 500;
}
.drawer-content {
padding: 1rem;
}
/* Cart item */
.cart-item {
display: flex;
justify-content: space-between;
padding: 1rem;
border-radius: 0.375rem;
border: 1px solid #e5e7eb;
margin-bottom: 1rem;
}
.cart-item-info {
display: flex;
gap: 1rem;
}
.cart-item-image {
width: 4rem;
height: 4rem;
border-radius: 0.25rem;
overflow: hidden;
}
.cart-item-image img {
width: 100%;
height: 100%;
object-fit: cover;
}
.cart-item-details h4 {
font-weight: 500;
}
.cart-item-meta {
font-size: 0.875rem;
color: #6b7280;
}
.cart-item-price {
font-weight: 600;
margin-top: 0.25rem;
}
.cart-item-actions {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 0.5rem;
}
.remove-btn {
background: none;
border: none;
color: #6b7280;
cursor: pointer;
width: 1.5rem;
height: 1.5rem;
}
.quantity-controls {
display: flex;
align-items: center;
gap: 0.5rem;
}
.qty-btn {
width: 1.5rem;
height: 1.5rem;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #e5e7eb;
border-radius: 0.25rem;
background: none;
color: #374151;
cursor: pointer;
}
.qty-display {
font-size: 0.875rem;
width: 1.5rem;
text-align: center;
}
.cart-summary-section {
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid #e5e7eb;
display: flex;
justify-content: space-between;
margin-bottom: 1rem;
}
.summary-label {
font-weight: 500;
}
.summary-value {
font-weight: 600;
}
/* Footer */
footer {
background-color: #111827;
color: white;
margin-top: 4rem;
padding-bottom: 6rem;
}
.footer-content {
display: grid;
grid-template-columns: 1fr;
gap: 2rem;
padding: 2.5rem 1rem;
}
@media (min-width: 768px) {
.footer-content {
grid-template-columns: repeat(4, 1fr);
}
}
.footer-brand h2 {
font-size: 1.25rem;
font-weight: 700;
margin-bottom: 1rem;
}
.footer-brand p {
font-size: 0.875rem;
color: #9ca3af;
}
.footer-links h3 {
font-size: 1.125rem;
font-weight: 600;
margin-bottom: 0.75rem;
}
.footer-links ul {
list-style: none;
}
.footer-link {
display: block;
padding: 0.5rem 0;
color: #9ca3af;
font-size: 0.875rem;
text-decoration: none;
transition: color 0.2s;
}
.footer-link:hover {
color: white;
}
.social-icons {
margin-top: 1.5rem;
display: flex;
gap: 1rem;
}
.social-link {
color: white;
font-size: 1.25rem;
transition: color 0.2s;
}
.social-link:hover {
color: #60a5fa;
}
.footer-bottom {
display: flex;
flex-direction: column;
align-items: center;
padding: 1.5rem 1rem;
border-top: 1px solid #374151;
}
@media (min-width: 768px) {
.footer-bottom {
flex-direction: row;
justify-content: space-between;
}
}
.copyright {
font-size: 0.875rem;
color: #9ca3af;
}
.footer-meta {
display: flex;
gap: 1rem;
margin-top: 1rem;
}
@media (min-width: 768px) {
.footer-meta {
margin-top: 0;
}
}
.meta-link {
color: #9ca3af;
font-size: 0.875rem;
text-decoration: none;
}
.meta-link:hover {
color: white;
}
.separator {
color: #4b5563;
}
// Image gallery functionality
const mainImage = document.getElementById('main-product-image');
const thumbnails = document.querySelectorAll('.thumbnail-btn');
thumbnails.forEach(thumb => {
thumb.addEventListener('click', () => {
// Update main image
mainImage.src = thumb.getAttribute('data-image');
// Update active thumbnail
thumbnails.forEach(t => t.classList.remove('active'));
thumb.classList.add('active');
});
});
// Color selector
const colorOptions = document.querySelectorAll('.color-option');
const selectedColorText = document.getElementById('selected-color');
colorOptions.forEach(option => {
option.addEventListener('click', () => {
// Update selected color
colorOptions.forEach(o => o.classList.remove('selected'));
option.classList.add('selected');
// Update text
selectedColorText.textContent = option.getAttribute('data-color-name');
});
});
// Size selector
const sizeOptions = document.querySelectorAll('.size-option');
const selectedSizeText = document.getElementById('selected-size');
sizeOptions.forEach(option => {
option.addEventListener('click', () => {
// Update selected size
sizeOptions.forEach(o => o.classList.remove('selected'));
option.classList.add('selected');
// Update text
selectedSizeText.textContent = option.getAttribute('data-size');
});
});
// Tab functionality
const tabBtns = document.querySelectorAll('.tab-btn');
const tabPanes = document.querySelectorAll('.tab-pane');
tabBtns.forEach(btn => {
btn.addEventListener('click', () => {
// Update active tab button
tabBtns.forEach(b => b.classList.remove('active'));
btn.classList.add('active');
// Update active tab pane
const tabId = btn.getAttribute('data-tab') + '-tab';
tabPanes.forEach(pane => pane.classList.remove('active'));
document.getElementById(tabId).classList.add('active');
});
});
// Cart drawer functionality
const openCartBtn = document.getElementById('open-cart');
const cartBtn = document.getElementById('cart-button');
const cartDrawer = document.getElementById('cart-drawer');
const backdrop = document.getElementById('drawer-backdrop');
const qtyPlus = document.querySelector('.qty-plus');
const qtyMinus = document.querySelector('.qty-minus');
const qtyDisplay = document.querySelector('.qty-display');
const cartSubtotal = document.getElementById('cart-subtotal');
const addToCartBtn = document.getElementById('add-to-cart');
function openCart() {
cartDrawer.classList.add('open');
backdrop.style.display = 'block';
document.body.style.overflow = 'hidden';
}
function closeCart() {
cartDrawer.classList.remove('open');
backdrop.style.display = 'none';
document.body.style.overflow = '';
}
openCartBtn.addEventListener('click', openCart);
cartBtn.addEventListener('click', openCart);
backdrop.addEventListener('click', closeCart);
// Quantity controls
let quantity = 1;
const price = 79.99;
function updateTotal() {
const total = (price * quantity).toFixed(2);
cartSubtotal.textContent = `$${total}`;
}
qtyPlus.addEventListener('click', () => {
quantity++;
qtyDisplay.textContent = quantity;
updateTotal();
});
qtyMinus.addEventListener('click', () => {
if (quantity > 1) {
quantity--;
qtyDisplay.textContent = quantity;
updateTotal();
}
});
// Add to cart button
addToCartBtn.addEventListener('click', () => {
// Show success message
alert('Item added to cart!');
});
Also see: Tab Triggers