Classes and an id

Name the elements on this page correctly.

What to build

The same list with the attributes added.

Requirements

  • Each of the two li elements has the class task.
  • The second also has the class done.
  • The ul has id="todo".

Constraints

Only one element may have the id.

Example

class="task done" gives an element two classes.

Why it works

Classes are shared, so that one style can apply to many elements; the id is unique, so that it can be found directly.

Hints

Hint 1

Several classes go in one attribute, separated by a space.

Hint 2

id must be unique.

Solution

Show one correct solution (try it yourself first)
<ul id="todo">
  <li class="task">Buy tea</li>
  <li class="task done">Pay rent</li>
</ul>

Lesson: Global attributes and custom data →