Responsive Grid
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 38 of 55.
A 320-pixel grid with grid-cols-1 md:grid-cols-2 has one column below md and two equal columns at md and wider. The responsive condition is based on viewport width, even when the grid itself has a fixed width.
<div class="grid w-80 grid-cols-1 md:grid-cols-2">Museum sample</div>You can add a wider breakpoint to increase density again. Build the narrow view first, then check intermediate widths so a layout does not depend on one large desktop screenshot.
Challenge
MediumUse one column below 768 pixels and five equal columns from 768 pixels upward in the supplied 320-pixel availability grid.
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="grid w-80"><span>Mon</span><span>Tue</span><span>Wed</span><span>Thu</span><span>Fri</span></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 Tailwind8Responsive Design
Breakpoint PrefixesResponsive DirectionResponsive GridResponsive VisibilityRecap: Responsive Design