Bounded Scroll Regions
Part of the Responsive UI Patterns section of Coddy's Tailwind CSS journey. Lesson 3 of 55.
An editor panel may have a toolbar, a long list and a footer inside a fixed-height window. In a 300px panel with 40px and 20px outer rows, the list gets 240px. The middle track minmax(0,1fr) lets that region fit rather than expand to the list length.
<section class="h-[300px] grid grid-rows-[auto_minmax(0,1fr)_auto]">
<header class="h-10">Tools</header>
<div class="min-h-0 overflow-y-auto">Long list</div>
<footer class="h-5">Help</footer>
</section>Give the scrolling child min-h-0 overflow-y-auto. The zero minimum allows shrinking; the overflow rule keeps excess content reachable. Put the toolbar and footer outside this child so scrolling the list does not move those controls away.
Challenge
MediumCreate a 320px-high session picker. Preserve its 48px header and 32px footer. Allocate the remaining 240px to the list region; the supplied 600px list must scroll vertically inside that region.
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="panel" class="h-80 grid grid-rows-[auto_auto_auto]"><header class="h-12">Sessions</header><div id="list" class="overflow-visible"><div class="h-[600px]">Session list</div></div><footer class="h-8">Selection help</footer></section>
</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