On this page
Product cards must work as individual summaries and as a repeated comparison system. A beautifully composed specimen can become a chaotic grid when titles wrap, prices vary, and images arrive in different shapes. Design the repeated structure before polishing the first card.
Choose an image frame that suits the catalog
Review a sample of actual products before choosing the media area. Clothing, software templates, and furniture have different visual needs. A square frame is a useful starting point, not a universal requirement. Wide products may need a landscape ratio, while portrait artwork may lose too much information in a short crop.
Use the Aspect Ratio Calculator to compare frame heights at your intended card widths. At 288 pixels wide, a 4:3 frame is 216 pixels tall, while a square frame is 288 pixels tall. That difference changes how many rows fit and how much attention imagery receives.
Define an image policy for cropping and background treatment. Consistent framing matters more than identical source dimensions. The MDN aspect-ratio reference explains how to preserve the chosen geometry in code.
Establish a repeatable information order
Choose the smallest set of details that helps people distinguish products: name, price, a meaningful attribute, and perhaps availability. Repeating category, brand, rating, shipping message, and three promotional badges on every card can bury the actual product identity.
Set a content hierarchy that remains stable when optional details are absent. Do not let a missing rating pull the price into a different position on one card. At the same time, avoid creating huge blank regions simply to make every baseline match. Alignment should aid comparison, not turn a short card into a hollow panel.
Decide how long names behave. Two or three lines may be a useful editorial target, but truncation can conceal the distinguishing variant. If you clamp text, make the complete name available through a sensible interaction or destination, and check whether two products become visually identical when shortened.
Keep price and unit information together. A low price per unit and a high package price should not be visually interchangeable. Present discount and previous-price information in a way that clearly identifies which amount applies now rather than using size and color alone.
Build the grid and the card independently
The grid decides how many cards fit; the card decides how its own content flows. Keeping these responsibilities separate makes the component more reusable in search results, recommendations, and category pages.
.product-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
gap: 1.5rem;
}
.product-card {
display: flex;
flex-direction: column;
min-inline-size: 0;
}
.product-media { aspect-ratio: 4 / 3; background: #f2f4f7; }
.product-media img {
inline-size: 100%;
block-size: 100%;
object-fit: contain;
}
.product-details { padding-block: 1rem; }
.product-actions { margin-block-start: auto; }The example uses contain to preserve the whole product. Editorial photography may call for cover instead. MDN's object-fit reference explains the difference. Neither choice fixes poor source photography, so review the source set rather than expecting CSS to normalize every image.
Use the CSS Grid Generator to test column counts against actual page widths. Avoid allowing cards to grow indefinitely when the results contain only one or two items; a maximum content width or deliberate sparse-result layout may be more appropriate.
Keep badges and actions from dominating
Use badge restraint. One meaningful label such as New or Low stock may help, while a cluster of competing pills makes the card harder to scan. Keep overlays away from important image details, and do not place text over unpredictable imagery without a reliable surface.
Decide whether the card has one destination or several controls. If it contains a favorite button or variant selector, do not wrap the entire card in a link that creates nested interactive elements. The visual design should identify what opens the product and what performs a separate action.
Give purchase actions consistent placement, but consider whether the listing contains enough information to support immediate purchase. A product with required size selection should not suggest that Add to cart will always complete the action immediately. The label and presentation should match the actual next step.
Avoid relying on hover to reveal essential prices or controls. Touch users and keyboard users need access to the same meaningful information. A hover treatment can add emphasis without becoming the only way to understand the card.
Test the complete listing, not one specimen
Create a mixed-content grid containing a short title, a long title, no image, a discount, an unavailable item, and a product with several variants. The repeated rhythm should survive those differences. Inspect the second row as carefully as the first.
Check the grid in its actual page container. Side filters, promotional banners, and result counts reduce the space available for cards. A three-column mockup without those neighbors may give an unrealistic impression of the final layout.
Use web.dev's responsive design course for broader layout review methods. Check enlarged text and intermediate widths where cards are too narrow for their details but the grid has not yet dropped a column. Do not solve those moments by making the text smaller.
Finally, record the image ratio, fit policy, title behavior, badge limit, and optional-content rules. Include a sparse result and an unavailable product in the specification. A card system becomes dependable when the exceptions are designed, not when every sample happens to contain the same amount of content.
Work through a column-width budget
Suppose the listing has 960 pixels of usable width after the filter sidebar is accounted for. Three columns with two 24-pixel gaps leave 912 pixels for cards, or 304 pixels each. Four columns with three gaps leave only 222 pixels per card. Compare those widths with the longest product name and the actual action labels before choosing the denser arrangement.
At 304 pixels, a 4:3 media frame is 228 pixels tall. Add the expected title lines, price block, padding, and action area to estimate the full row height. This makes the tradeoff concrete: another column may expose more products horizontally while making each description harder to distinguish.
Test the transition with the filters open and closed. If the available listing width changes without the viewport changing, the grid still needs to respond sensibly. Keep the minimum card width tied to content needs rather than a named device breakpoint. Finally, compare two neighboring variants with similar photography; their distinguishing size, material, or license must remain visible without opening both destinations.
Key takeaways
- Choose image geometry from real catalog content.
- Keep essential product details in a predictable order.
- Separate grid behavior from internal card layout.
- Limit badges and make independent controls clear.
- Review mixed content and sparse results before approval.
Reach designers & developers at work
Put your product next to the tools people use every day. One sponsor per placement, no tracking pixels.
Become a sponsor