.discount-badge-text background: #fee2e2; color: #c2412c; font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 30px;
.product-category font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; color: #5b6e8c; margin-bottom: 0.6rem;
.product-img width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.1); responsive product card html css codepen
.btn-add:hover background: #1e2f47; transform: scale(0.98); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05);
<!-- Product Card 4 - Ceramic Mug (minimal) additional responsive demo --> <div class="product-card"> <div class="card-media"> <span class="badge hot">🌱 Eco</span> <img class="product-img" src="https://images.unsplash.com/photo-1514228742587-6b1558fcca3d?w=500&auto=format" alt="Artisan ceramic mug" loading="lazy"> </div> <div class="card-content"> <div class="product-category">Home & Living</div> <h3 class="product-title">Stoneware Mug</h3> <p class="product-description">Handcrafted ceramic, dishwasher safe. Perfect for morning coffee or tea rituals.</p> <div class="rating"> <div class="stars"> <span class="star-filled">★</span><span class="star-filled">★</span><span class="star-filled">★</span><span class="star-filled">★</span><span class="star-empty">★</span> </div> <span class="review-count">(53 reviews)</span> </div> <div class="price-row"> <span class="current-price">$24.90</span> <span class="old-price">$34.90</span> <span class="discount-badge-text">-28%</span> </div> <button class="btn-add" aria-label="Add to cart">☕ Add to cart</button> </div> </div> </div> <div class="container-footer"> <div class="demo-note"> ⚡ Fully responsive product cards | Hover effect | Flex grid | Modern design </div> </div> </div> .discount-badge-text background: #fee2e2
<!-- micro interaction: simple console feedback for demo (optional, but shows JS integration) --> <script> (function() // Add subtle interactive feedback for buttons — keeps the codepen alive and realistic const allButtons = document.querySelectorAll('.btn-add'); allButtons.forEach(btn => btn.addEventListener('click', function(e) e.preventDefault(); // get product title from sibling element (card content hierarchy) const card = this.closest('.product-card'); const titleElem = card?.querySelector('.product-title'); const productName = titleElem ? titleElem.innerText : 'Product'; // Provide temporary micro feedback const originalText = this.innerHTML; this.innerHTML = '✓ Added!'; this.style.backgroundColor = '#1f8a4c'; setTimeout(() => this.innerHTML = originalText; this.style.backgroundColor = '#101d2f'; , 1000); // Optional log: feel free to remove, but good for demo console.log(`🛍️ Added "$productName" to cart (demo interaction)`); ); ); )(); </script> </body> </html>
/* extra responsive touches */ @media (max-width: 680px) body padding: 1.2rem; .card-content padding: 1.2rem 1rem 1.4rem; .product-title font-size: 1.2rem; .current-price font-size: 1.5rem; padding: 0.2rem 0.6rem
.star-filled color: #f5b342; font-size: 0.9rem;