Menu
CoddyTech

Responsive Feature Cards

Part of the Responsive UI Patterns section of Coddy's Tailwind CSS journey. Lesson 13 of 55.

A featured item may need a different layout from a small tile. Make the card itself a grid so its media and copy can stack on narrow screens and share a row on wider screens. The surrounding page can still use its own independent grid.

<article class="grid grid-cols-1 md:grid-cols-[144px_minmax(0,1fr)] gap-3"><div>Media</div><section><h2>Featured event</h2><p>Event description</p></section></article>

The example keeps a 144px media track from 768px upward and gives the copy a zero-minimum flexible track. The underscore separates track values inside the arbitrary utility. A zero minimum helps long content fit the card’s allocated space.

Preserve a useful source order instead of duplicating content for each breakpoint. Add a third track for actions only when the wide layout has enough room, and keep gaps on both axes so stacked content remains separated.

challenge icon

Challenge

Medium

Stack the card media and text below 768px. At 768px and wider use a 192px media track and a shrinking remaining-space text track. Keep 16px gaps on both axes at all widths. Preserve the media-first reading order and the heading.

Preserve the supplied content, semantic elements and IDs. Edit the requested utility classes. Press Run preview after edits, then Check/Run code to grade the result. Supplied JavaScript is read-only.

Try it yourself

<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Interface workshop</title><link rel="stylesheet" href="./styles.css"></head><body>
<article id="card" class="w-full max-w-[640px] grid grid-cols-1 gap-4"><div id="media" class="h-32 bg-slate-200">Workshop illustration</div><section id="copy"><h2>Clay studio</h2><p>Try hand-built pottery.</p></section></article>
</body></html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Responsive UI Patterns