Flexible Content Rails
Part of the Responsive UI Patterns section of Coddy's Tailwind CSS journey. Lesson 2 of 55.
A documentation layout can combine a 120px sidebar with the remaining page width. In an 800px grid with a 16px gap, the main track gets 664px. Writing minmax(0,1fr) allows that track to shrink instead of treating a long line as its minimum width.
<div class="grid grid-cols-[120px_minmax(0,1fr)] gap-4">
<aside>Topics</aside>
<main class="overflow-x-auto">Documentation</main>
</div>A responsive rail needs both a track change and a visibility decision. Stack or remove supplementary navigation on narrow screens, and keep genuinely wide content in a local scroll region. A zero minimum controls allocation; an overflow utility controls access to the content.
Challenge
MediumBuild a responsive schedule with a category rail. Below 768px, use one column and hide the rail. At 768px and wider, use a 160px rail, a 16px gap and a remaining-space main track that may shrink below its content width. Keep the supplied main region horizontally scrollable.
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>
<div id="layout" class="w-full max-w-[640px] grid grid-cols-1 gap-4"><aside id="rail" class="block">Categories</aside><main id="content" class="min-w-0 overflow-x-auto"><pre class="w-[800px]">A deliberately wide schedule</pre></main></div>
</body></html>
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
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 Browser