Toggle navigation
☰
Home
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <!-- Place the following CSS in your <head> or stylesheet --> <style> /* This is an optional body style to provide a background for the page */ body { background-color: #f9fafb; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; } /* === Grid Container for the Cards === */ .cards-grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; padding: 1.5rem; } /* === Product Card Styles === */ .product-card { --product-card-radius: 12px; --product-card-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.07); background-color: #ffffff; border-radius: var(--product-card-radius); box-shadow: var(--product-card-shadow); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 0.2s ease, transform 0.2s ease; } .product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); } .product-card a.product-card-link { text-decoration: none; color: inherit; } /* Image container */ .product-card-image-container { position: relative; background-color: #f3f4f6; /* Fallback for transparent images */ } .product-card-image { width: 100%; height: 300px; object-fit: cover; display: block; } /* Product details */ .product-card-content { padding: 1rem 1.25rem; display: flex; flex-direction: column; flex-grow: 1; /* Pushes footer to the bottom */ } .product-card-category { font-size: 0.8rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; } .product-card-title { font-size: 1.1rem; font-weight: 600; line-height: 1.4; margin: 0; } /* Price and Action button footer */ .product-card-footer { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-top: 1px solid #f3f4f6; margin-top: 1rem; } .product-card-price { font-size: 1.2rem; font-weight: 700; color: #111827; } .product-card-cta { background-color: #1f2937; color: #ffffff; font-size: 0.9rem; font-weight: 500; border: none; border-radius: 8px; padding: 0.6rem 1rem; cursor: pointer; transition: background-color 0.2s ease; } .product-card-cta:hover { background-color: #374151; } </style> <!-- Place the following HTML in your <body> --> <div class="cards-grid-container"> <!-- Product 1 --> <article class="product-card"> <a href="#" class="product-card-link"> <div class="product-card-image-container"> <!-- Image by placehold.co. Replace with your own. --> <img src="https://placehold.co/600x600/6366f1/ffffff/png?text=Sneakers" alt="A pair of colorful modern athletic sneakers." class="product-card-image"> </div> <div class="product-card-content"> <span class="product-card-category">Footwear</span> <h3 class="product-card-title">Velocity Air Sneakers</h3> </div> </a> <footer class="product-card-footer"> <span class="product-card-price">$120.00</span> <button type="button" class="product-card-cta">Add to Cart</button> </footer> </article> <!-- Product 2 --> <article class="product-card"> <a href="#" class="product-card-link"> <div class="product-card-image-container"> <!-- Image by placehold.co. Replace with your own. --> <img src="https://placehold.co/600x600/f59e0b/ffffff/png?text=Watch" alt="A stylish silver wristwatch with a dark face." class="product-card-image"> </div> <div class="product-card-content"> <span class="product-card-category">Accessories</span> <h3 class="product-card-title">Titanium Chronograph Watch</h3> </div> </a> <footer class="product-card-footer"> <span class="product-card-price">$250.00</span> <button type="button" class="product-card-cta">Add to Cart</button> </footer> </article> <!-- Product 3 --> <article class="product-card"> <a href="#" class="product-card-link"> <div class="product-card-image-container"> <!-- Image by placehold.co. Replace with your own. --> <img src="https://placehold.co/600x600/10b981/ffffff/png?text=Audio" alt="A pair of sleek wireless over-ear headphones in black." class="product-card-image"> </div> <div class="product-card-content"> <span class="product-card-category">Audio</span> <h3 class="product-card-title">Aura Wireless Headphones</h3> </div> </a> <footer class="product-card-footer"> <span class="product-card-price">$180.00</span> <button type="button" class="product-card-cta">Add to Cart</button> </footer> </article> </div>