Grid Columns
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 26 of 55.
A 320-pixel-wide grid grid-cols-2 container with no gap creates two 160-pixel columns. The column utility divides available width into equal tracks; it does not set the number of children.
<div class="grid w-80 grid-cols-2">Museum sample</div>Additional children fill new rows automatically. A gap consumes some width before tracks share the remaining space, so equal tracks become narrower when a horizontal gap is added. The numeric suffix is a count: for example, grid-cols-6 requests six equal columns. For unequal tracks, grid-cols-[120px_1fr] makes the first column 120 pixels wide and lets the second take the remaining available space. The underscore represents the space between the two CSS track values.
Challenge
MediumArrange the five rating cells in five equal columns inside the supplied 320-pixel grid. Keep zero gap.
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>1</span><span>2</span><span>3</span><span>4</span><span>5</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