Border Width
Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 16 of 55.
A note with border-2 border-black has a 2-pixel black border. Width and color are independent utilities; Tailwind Preflight supplies a solid border style.
<div class="border-black border">Museum sample</div>A border occupies space in the box. Preflight also uses border-box sizing, so an explicit width includes border and padding. Add a border to separate a surface without using a large margin. Brackets allow an exact CSS value outside the scale: border-[5px] requests a 5-pixel border.
Challenge
EasyGive the pass a solid black border exactly 3 pixels wide on every side. Brackets allow a one-off CSS value such as border-[3px].
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="border-black">Guest pass</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