Menu
CoddyTech

Recap: Container Queries

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

challenge icon

Challenge

Hard

Build a locally responsive event tile in the supplied host. Establish inline-size containment. Stack title and details below a host width of 480px; use two equal tracks at 480px and wider, with 24px gaps on both axes. Size the heading at 4% of host width, bounded between 16px and 24px. The supplied host starts at 360px and can expand to 504px or 800px.

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>
<section id="host" class="w-[360px] "><article id="tile" class="grid grid-cols-1"><h2 id="title" class="text-base">Open studio night</h2><p>Meet the artists.</p></article></section><button id="size504" class="m-2">Width 504</button><button id="size800" class="m-2">Width 800</button>
<script src="./controls.js"></script>
</body></html>

All lessons in Responsive UI Patterns