Layout Gaps
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 9 of 55.
The supplied row uses flex, which arranges direct children along a main axis. Adding gap-3 puts 12 pixels between neighboring items without adding an outer gap.
<div class="flex gap-3">Museum sample</div>A gap belongs on the flex or grid parent, not on each child. The same numeric spacing scale applies. Row and column gaps can be changed independently with gap-y and gap-x.
Challenge
EasySeparate the supplied category chips by 28 pixels in their existing flex row. Set the same gap for both axes.
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"><span>Art</span><span>Science</span><span>Music</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