Grid Item Alignment
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 29 of 55.
In a grid, justify-items-center centers each child within its own cell along the inline axis. Unlike justify-content, it aligns items within tracks rather than distributing the whole track collection.
<div class="grid grid-cols-2 h-40 justify-items-center">Museum sample</div>Pair inline alignment with items-center for vertical centering in this horizontal writing mode. The shorthand place-items-center sets both axes at once when both should be centered.
Challenge
MediumCenter each gallery label on both axes of its grid cell, with a 28-pixel gap between cells.
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 grid-cols-2 h-40"><span>East</span><span>West</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