.star-filled color: #f5b342; font-size: 0.9rem;
<!-- Product Card 3 - Smartwatch (elegant) --> <div class="product-card"> <div class="card-media"> <!-- no badge for variation --> <img class="product-img" src="https://images.unsplash.com/photo-1579586337278-3befd40fd17a?w=500&auto=format" alt="Smartwatch with modern display" loading="lazy"> </div> <div class="card-content"> <div class="product-category">Electronics</div> <h3 class="product-title">Lumina Smartwatch S3</h3> <p class="product-description">Heart rate tracking, GPS, 7-day battery life. Sleek design meets performance.</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-filled">★</span> </div> <span class="review-count">(342 reviews)</span> </div> <div class="price-row"> <span class="current-price">$189.99</span> <span class="old-price">$249.99</span> <span class="discount-badge-text">-24%</span> </div> <button class="btn-add" aria-label="Add to cart">⌚ Add to cart</button> </div> </div>
.old-price font-size: 0.9rem; font-weight: 500; color: #9aaec9; text-decoration: line-through; responsive product card html css codepen
/* price row */ .price-row display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.2rem;
.badge.new background: #1f8a4c;
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <title>Responsive Product Card | Modern UI Component</title> <!-- Google Fonts & simple CSS reset --> <link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700&display=swap" rel="stylesheet"> <style> * margin: 0; padding: 0; box-sizing: border-box;
/* rating stars (inline flex) */ .rating display: flex; align-items: center; gap: 0.4rem; margin-bottom: 1rem; flex-wrap: wrap; .star-filled color: #f5b342
.product-card:hover .product-img transform: scale(1.03);
<!-- 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> !-- no badge for variation -->