HTML Lists and Tables

Mark up lists and tabular data with the right elements.

HTML
<ul>
  <li>HTML</li>
  <li>CSS</li>
</ul>
<table>
  <tr><th>Language</th><th>Year</th></tr>
  <tr><td>C</td><td>1972</td></tr>
</table>

Explanation

Use ul for an unordered list and li for each item. Use a table only for data that has rows and columns: tr is a row, th is a header cell, and td is a data cell. Headers let assistive technology connect each value to its column.

Explore the dry run
Guided walkthroughReady
1<ul>
2 <li>HTML</li>
3 <li>CSS</li>
4</ul>
5<table>
6 <tr><th>Language</th><th>Year</th></tr>
7 <tr><td>C</td><td>1972</td></tr>
8</table>

Follow the example

Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.

View the complete dry-run table
Prepared trace of the published program. Some rows group repeated iterations.
Step / lineWhat happensState after stepOutput so far
ul starts an unordered list.—
—
Each li is one list item.—
—
table holds rows and columns of data.—
—
A row of header cells.—
—
A row of data cells under those headers.—
—