Recap: Container Queries
Part of the Responsive UI Patterns section of Coddy's Tailwind CSS journey. Lesson 30 of 55.
Challenge
HardBuild 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
1Page Shells
Growing Page ShellsFlexible Content RailsBounded Scroll RegionsFull-Bleed RegionsRecap: Page Shells4Form Layouts
Responsive Field GroupsFocused Field GroupsSelectable Form OptionsNative Validation CuesRecap: Form Layouts2Navigation Patterns
Wrapping NavigationCurrent Page CuesNative Menu DisclosuresKeyboard Skip LinksRecap: Navigation5Data Tables
Scrollable Data TablesPredictable Table ColumnsRow State PresentationSticky Table HeadersRecap: Data Tables8Interactive Panels
Expanded Control CuesChoice Card StatesFocus-Aware Help PanelsContent-Aware Empty StatesRecap: Interactive Panels11Project: Event Portal
Portal ShellSession Browser3Content Cards
Aligned Card ActionsCard Media FramesResponsive Feature CardsShared Card RowsRecap: Content Cards6Container Queries
Component Width QueriesBounded Component StatesNamed Query RegionsBounded Fluid ComponentsRecap: Container Queries