codegurukool.com · Free coding tutorials & online compiler

Home › HTML Tutorial › Lists and tables

Lists and tables

Show items in order, out of order, or in a grid.

ul makes a bulleted list, ol a numbered one, and table arranges data in rows and columns.

Commands in this lesson

ul

Definition: Unordered (bulleted) list. Items go inside li.

Syntax:

<ul><li>item</li></ul>

Example:

<ul><li>Apples</li><li>Pears</li></ul>

ol

Definition: Ordered (numbered) list.

Syntax:

<ol><li>item</li></ol>

Example:

<ol><li>Mix</li><li>Bake</li></ol>

table

Definition: Shows data in rows (tr) and cells (td, th).

Syntax:

<table><tr><th>head</th></tr><tr><td>cell</td></tr></table>

Example:

<table border="1"><tr><th>Name</th><th>Age</th></tr><tr><td>Asha</td><td>20</td></tr></table>

Example code

<ul><li>Apples</li><li>Pears</li></ul>
<ol><li>Wake up</li><li>Code</li></ol>
<table border="1" cellpadding="6">
  <tr><th>Language</th><th>Job</th></tr>
  <tr><td>HTML</td><td>Structure</td></tr>
  <tr><td>CSS</td><td>Style</td></tr>
</table>

Run this code in the online editor

← Links and imagesForms →