Lists & Tables
Unordered, ordered and description lists, plus accessible tabular data.
Unordered & Ordered Lists
<ul>
<li>Tea</li>
<li>Green Tea</li>
</ul>
<ol type="1" start="1">
<li>Preheat oven</li>
<li>Mix dry ingredients</li>
<li>Bake 30 minutes</li>
</ol>
<ul>— items marked with bullets; order doesn't matter; supports unlimited nesting.<ol>— numbered steps.type:1(default),A,a,I,i.startsets the first number.
Use <ul> for unordered sets (navigation menus, features) and <ol> for steps, instructions and rankings.
Description Lists & Nesting
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language - the structure of web pages</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets - the styling of web pages</dd>
</dl>
<dl>— description list container (glossaries, FAQs, metadata).<dt>— description term (the word being defined).<dd>— description definition (the explanation, indented).
Lists nest naturally by placing a new <ul>/<ol> inside an <li>.
List CSS tips
list-style-type: none— removes bullets (for nav menus).list-style-image: url()— custom bullet image.list-style-position: inside— bullet inside the box.
Tables — Basic Structure
<table>
<caption>Student Grades</caption>
<thead>
<tr><th scope="col">Name</th><th scope="col">Grade</th></tr>
</thead>
<tbody>
<tr><td>Aina</td><td>A</td></tr>
</tbody>
<tfoot>
<tr><td colspan="2">Passed: 1</td></tr>
</tfoot>
</table>
| Element | Purpose |
|---|---|
<table> | Container for the entire table |
<caption> | Accessible title — place immediately after <table> |
<thead> | Groups header row(s) — aids screen readers |
<tbody> | Groups body rows (browser adds if omitted) |
<tfoot> | Groups footer rows (totals, summaries) |
<tr> | Table row |
<th> | Header cell — bold by default; add scope="col" or scope="row" |
<td> | Table data cell — regular content |
Tables are for tabular data ONLY. Use CSS Grid or Flexbox for page layout.
Tables — Spanning, Alignment & Styling
colspan— span columns:<th colspan="3">Fruit Juice Drinks</th>rowspan— span rows:<td rowspan="2">Shared Cell</td>- Alignment via CSS:
text-align: center | right,vertical-align: top.
table { border-collapse: collapse; width: 100%; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid #ddd; }
thead { background-color: #002137; }
tbody tr:hover { background-color: #0a2040; }
Deprecated HTML attributes → use CSS instead
align→text-aligncellspacing→border-spacingbgcolor→background-colorvalign→vertical-aligncellpadding→paddingontd/thborder→ the CSSborderproperty
Activity — complete the code
Complete the code correctly to mark this lesson as complete automatically.
Complete the list and table markup.
<ul>Home</li><li>About</li></ul><table border="1"><tr><>Name</th><th>Age</th></tr><tr>Aina</td><td>21</td></tr></table>