HTML Lists & Tables
HTML Lists
Unordered List (<ul>)
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
- Default marker: disc (•)
- Change with
typeattribute:disc,circle,square
Ordered List (<ol>)
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
- Default: numeric (1, 2, 3)
typeattribute:A(uppercase),a(lowercase),I(Roman),i(roman)
Nested Lists
<ul>
<li>Fruits
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
</li>
</ul>
HTML Tables
Basic Table Structure
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Rahul</td>
<td>15</td>
</tr>
</table>
Merging Cells
{/* colspan: merge columns */}
<td colspan="2">Spans 2 columns</td>
{/* rowspan: merge rows */}
<td rowspan="3">Spans 3 rows</td>
Table Attributes
border— Border widthcellpadding— Space within cellscellspacing— Space between cellswidth— Table widthalign— Table alignment (left, center, right)
Exam Tips
- Know the difference between
<ul>and<ol> - Practice creating tables with merged cells
- Remember to close all tags properly