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: #f3f4f6; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; } /* Container for the list */ .list-view-container { max-width: 800px; margin: 2rem auto; padding: 0 1rem; display: grid; gap: 1rem; } /* === Horizontal Product Card Styles === */ .hp-card { --hp-card-radius: 12px; --hp-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(--hp-card-radius); box-shadow: var(--hp-card-shadow); display: flex; overflow: hidden; transition: box-shadow 0.2s ease; } .hp-card:hover { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); } .hp-card-image-wrapper { position: relative; flex-shrink: 0; } .hp-card-image { width: 140px; height: 100%; object-fit: cover; display: block; } .hp-card-content { padding: 1rem 1.25rem; display: flex; flex-direction: column; flex-grow: 1; } .hp-card-main-info { flex-grow: 1; /* Pushes footer to the bottom */ } .hp-card-category { font-size: 0.8rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; } .hp-card-title-link { text-decoration: none; color: inherit; } .hp-card-title-link:hover .hp-card-title { color: #4f46e5; } .hp-card-title { font-size: 1.125rem; font-weight: 600; line-height: 1.4; margin: 0; transition: color 0.2s ease; } .hp-card-description { font-size: 0.95rem; line-height: 1.5; color: #4b5563; margin: 0.5rem 0 0; /* Optional: Clamp text to 2 lines */ display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } /* Card footer */ .hp-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #f3f4f6; gap: 1rem; } .hp-card-price { font-size: 1.1rem; font-weight: 700; color: #111827; } .hp-card-actions { display: flex; gap: 0.5rem; } .hp-card-cta-btn { background-color: #1f2937; color: #ffffff; font-size: 0.875rem; font-weight: 500; border: none; border-radius: 8px; padding: 0.5rem 0.8rem; cursor: pointer; white-space: nowrap; transition: background-color 0.2s ease; } .hp-card-cta-btn:hover { background-color: #374151; } /* Responsive adjustments for smaller screens */ @media (max-width: 500px) { .hp-card { flex-direction: column; } .hp-card-image { width: 100%; height: 180px; } } </style> <!-- Place the following HTML in your <body> --> <div class="list-view-container"> <!-- Card 1 --> <article class="hp-card"> <div class="hp-card-image-wrapper"> <!-- Image by placehold.co. Replace with your own. --> <img src="https://placehold.co/280x280/818cf8/ffffff/png?text=Smart+Watch" alt="A modern smartwatch with a dark strap." class="hp-card-image"> </div> <div class="hp-card-content"> <div class="hp-card-main-info"> <a href="#" class="hp-card-title-link"> <div class="hp-card-category">Electronics</div> <h3 class="hp-card-title">Orbit Smart Watch</h3> </a> <p class="hp-card-description">Stay connected on the go with our latest smartwatch, featuring a vibrant display and long-lasting battery.</p> </div> <footer class="hp-card-footer"> <span class="hp-card-price">$299.99</span> <div class="hp-card-actions"> <button type="button" class="hp-card-cta-btn">Add to Cart</button> </div> </footer> </div> </article> <!-- Card 2 --> <article class="hp-card"> <div class="hp-card-image-wrapper"> <!-- Image by placehold.co. Replace with your own. --> <img src="https://placehold.co/280x280/c084fc/ffffff/png?text=Keyboard" alt="A mechanical gaming keyboard with RGB lighting." class="hp-card-image"> </div> <div class="hp-card-content"> <div class="hp-card-main-info"> <a href="#" class="hp-card-title-link"> <div class="hp-card-category">PC Peripherals</div> <h3 class="hp-card-title">MK-II Mechanical Keyboard</h3> </a> <p class="hp-card-description">A tactile and responsive keyboard designed for both gamers and typists. Fully customizable RGB lighting.</p> </div> <footer class="hp-card-footer"> <span class="hp-card-price">$160.00</span> <div class="hp-card-actions"> <button type="button" class="hp-card-cta-btn">Add to Cart</button> </div> </footer> </div> </article> </div>