css · level 1 · unit 5 · lesson 3
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
A draws a line round the box.
A border is a line round the edge of a box, outside the padding. border is a : one property that sets three things at once, a width, a style and a colour, like 3px solid teal.
The style says how the line looks: solid for a plain line, dashed for dashes and dotted for dots. Leave out the style and there is no border at all.
Want one side only? border-bottom draws a line under the box, which looks smart under a heading. border-top, border-left and border-right work the same way.
<div class="ticket">Admit one</div> .ticket {
border: 3px dashed crimson;
padding: 16px;
} Press show my page to see it here.
Try dotted and then solid in place of dashed.
guess first
No style given. What do you see?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
<p class="frame">Picture frame</p> .frame {
border: 4px navy;
padding: 10px;
}
your turn
Your turn. Underline a heading in style.
Give the heading a line along the bottom only. Fill in the property and a value with a width, a style and a colour, like 4px dotted orange.
the page you’re styling
<h1>Holiday photos</h1>your css
Press show my page to see it here.
- the heading has a line underneathnot checked yet
- there is no line on topnot checked yet
fix it
The coupon has no border. Can you fix it?
the page you’re styling
<p class="coupon">10% off all cakes</p>your css
Press show my page to see it here.
- the coupon has a solid linenot checked yet
- the line is greennot checked yet
- No border at all, so the whole declaration was skipped. One of the three values has a typo.
- Check the style word. It should be
solid,dashedordotted. - Change
soildtosolid, then press run.
nailed it
you drew lines round your boxes. :D
bordertakes a width, a style and a colour.- No style means no border at all.
border-bottomdraws a line on one side only.
new words in your collection
- border
- shorthand
This lesson isn’t saved. A free account remembers every lesson you finish.