Skip to main content
๐ŸŽจ CSS Basics

Borders ๐ŸŸซ

A border draws a visible edge around a box. It needs three things at once: a width (how thick), a style (like solid), and a color. You can set all three in one line:

.box { border: 2px solid black; }

Read it as: "a 2-pixel, solid, black border." The order is width โ†’ style โ†’ color, with spaces between.

๐Ÿ’ก A border needs a style like solid to show up at all โ€” without it, there's nothing to draw.

Your task

Give .box a border that is 2px solid black. Drag the blocks in, or type the line.

black computes to rgb(0, 0, 0).

โšก 25 XP

Hints

index.htmliframe
Loading editorโ€ฆ
Preview
Run your code to see test results.