CodeBlanks Logo Icon CodeBlanks

Challenge - Lists and tables

HTML course · Beginner · Lesson 66/68

Write a page with nested lists and a schedule table.

Recall lists and tables

Lists and tables show repeated information cleanly. <ul> gives an unordered list, <ol> an ordered one; each item goes in an <li>. Lists can nest: open a new <ul> inside an <li> and you get a sub-list.

Tables start with <table>; rows are <tr>, cells <td>, header cells <th>. <thead> and <tbody> organize the table; colspan merges cells across columns, rowspan across rows.

Exercise Write a nested list and a schedule table

Add a <h2> heading to body, then a <ul> list under it. Inside one list item, add a second <ul> for a sub-list (nested list). Then build a <table> with a <caption>, <thead> holding <th> header cells, and a <tbody> with at least one row.

Show example solution
<body>
  <h2>My Reading List</h2>
  <ul>
    <li>
      Novels
      <ul>
        <li>Orhan Pamuk</li>
        <li>Elif Shafak</li>
      </ul>
    </li>
    <li>Poetry</li>
  </ul>
  <table>
    <caption>Event Schedule</caption>
    <thead>
      <tr>
        <th scope="col">Date</th>
        <th scope="col">City</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>May 5</td>
        <td>Istanbul</td>
      </tr>
    </tbody>
  </table>
</body>

Test yourself

  1. Write the table header cell

    <table>
      <caption>Concert Schedule</caption>
      <thead>
        <tr>
          <____ scope="col">Date</th>
          <th scope="col">City</th>
        </tr>
      </thead>
    </table>
    Show answer
    <table>
      <caption>Concert Schedule</caption>
      <thead>
        <tr>
          <th scope="col">Date</th>
          <th scope="col">City</th>
        </tr>
      </thead>
    </table>
  2. Which attribute merges two columns on a <td>?

    • rowspan
    • span
    • colspan
    • merge
    Show answer

    colspan — Correct. colspan makes a cell span multiple columns side by side.

  3. Match each tag to its role

    <ul>
    Unordered list
    <ol>
    Ordered list
    <li>
    List item
    <table>
    Table container
    <th>
    Header cell

All lessons in Beginner