css · level 1 · unit 1 · lesson 2
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
HTML wraps each piece of content in tags.
A ="pl-term" data-term="0" aria-expanded="false">tag is a word in angle brackets, like <p>. Most come in pairs: an opening tag <p> and a closing tag </p> with a slash. The pair plus everything between them is an .
<h1> is a big heading and <p> is a paragraph. <ul> holds a list, and each <li> inside it is one item. You will meet more tags as you need them.
Some tags carry labels. A class, like class="note", is a group label that many elements can share. An , like id="title", is a name that belongs to one element only.
<h1 id="title">Shopping list</h1>
<p class="note">Do not forget the milk.</p>
<ul>
<li>Milk</li>
<li class="note">Bread</li>
</ul> li {
color: teal;
} Press show my page to see it here.
The CSS here names a tag, li, and paints every element with that tag teal.
guess first
One paragraph has a class. Which lines turn teal?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
<h1 id="title">Pet show</h1>
<p>Rex the dog wins a rosette.</p>
<p class="note">Pickles the cat came second.</p> p {
color: teal;
}
your turn
Your turn. Find the right tag.
The CSS should colour the paragraph. Type the paragraph's tag name in place of the blank, without the angle brackets, then press run.
the page you’re styling
<h1>Today's weather</h1>
<p>Sunny with a light breeze.</p>your css
Press show my page to see it here.
- the paragraph is purplenot checked yet
- the heading stays blacknot checked yet
fix it
The snacks will not turn orange. Can you fix it?
the page you’re styling
<h1>Snacks</h1>
<ul>
<li>Crisps</li>
<li>Apples</li>
</ul>your css
Press show my page to see it here.
- the snacks are orangenot checked yet
- Look at the tags in the HTML, then at the first word of the CSS.
- The list items use
<li>. Is the CSS spelt the same way? - Two letters are swapped. Change
iltoli, then press run.
nailed it
you can read the tags behind a page. :D
- Tags mark where content starts and ends:
<p>and</p>. - Many elements can share a class. An id belongs to one.
- CSS can name a tag to style every element with it.
new words in your collection
- tag
- element
- class
- id
This lesson isn’t saved. A free account remembers every lesson you finish.