Axis Spacing
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 7 of 55.
A compact tag with px-3 py-1 gets 12 pixels of horizontal padding and 4 pixels vertically. The x axis covers left and right; the y axis covers top and bottom.
<div class="px-3 py-1">Museum sample</div>Use separate axis utilities when a control should be wider without becoming much taller. Each axis declaration sets a pair of sides, so it avoids four repeated side utilities.
Challenge
EasyGive the route badge 28 pixels of horizontal padding and 12 pixels of vertical padding.
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="">Route 12</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