Cross Axis Alignment
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 23 of 55.
In a horizontal flex row, items-center aligns items vertically through their centers. The cross axis is perpendicular to the main axis, so it becomes horizontal in a flex column.
<div class="flex h-32 items-center">Museum sample</div>Baseline alignment is useful when text sizes differ: items-baseline lines up text baselines instead of box centers. Give a row enough height to see the difference between start, center and end alignment.
Challenge
MediumAlign the metric label and value on their text baselines and leave 28 pixels between them. Use the specified gap value for both row and column gaps.
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 h-32"><span class="text-sm">Visitors</span><span class="text-3xl">48</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