Wrapping Rows
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 24 of 55.
A flex row with flex-wrap may move items onto additional lines when their combined width exceeds the container. flex-nowrap keeps a single line, which may squeeze items or overflow depending on their sizing.
<div class="flex w-80 flex-nowrap">Museum sample</div>Use a gap to separate wrapped rows as well as columns. A child marked shrink-0 keeps its width, making wrapping predictable instead of allowing flex shrink to compress all the items onto one line.
Challenge
MediumMake the supplied nonshrinking tags wrap inside their 320-pixel row. Leave a 28-pixel gap horizontally and vertically.
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="flex w-80"><span class="w-40 shrink-0">Pottery</span><span class="w-40 shrink-0">Photography</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 Tailwind