Main Axis Alignment
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 22 of 55.
A 300-pixel flex row with two small buttons and justify-center puts unused horizontal space on both sides of the group. The main axis follows the flex direction, so a column would distribute vertical space instead.
<div class="flex w-80 justify-center">Museum sample</div>Alignment requires spare room in the container. Space-distribution values place that room between or around items; they do not add padding inside the items. justify-between puts spare room between items, while justify-evenly gives every gap, including the outer ones, equal space.
Challenge
MediumPlace the two navigation labels at opposite ends of the supplied row, retaining a minimum 28-pixel gap. 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 w-80"><span>Previous</span><span>Next</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