Maximum Width
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 33 of 55.
A reading panel with w-full max-w-md fills its container until it reaches a maximum width of 448 pixels. The maximum is a cap, not a demand to always occupy that much space.
<div class="w-full mx-auto max-w-md">Museum sample</div>Add mx-auto to split available horizontal margin and center a capped block. On a narrower parent the panel shrinks with it, so a maximum width avoids the horizontal overflow of an unnecessarily fixed desktop width. The named caps are max-w-xs (320px), max-w-sm (384px), max-w-md (448px), max-w-lg (512px), max-w-xl (576px), max-w-2xl (672px) and max-w-3xl (768px).
Challenge
MediumCap the full-width reading panel at 576 pixels and center it with automatic horizontal margins.
Keep the supplied content and element IDs. Edit the HTML utility classes or the requested CSS. Click Run preview to refresh the preview after edits, then use Check/Run code to grade your work.
Try it yourself
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Practice studio</title><link rel="stylesheet" href="./styles.css"></head><body>
<div id="target" class="w-full mx-auto">Reading room</div>
</body></html>
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
1Meet Tailwind
A Styled First RunChoosing UtilitiesCombining UtilitiesThe Local StylesheetRecap: Meet Tailwind7Sizing and Overflow
Element WidthElement HeightMaximum WidthOverflow BehaviorRecap: Sizing and Overflow