HTML Lists and TablesπŸ“‹


1️⃣ Lists in HTML

Lists are used to group related items. There are two main types:

Example: Unordered List

<ul>
  <li>Apple</li>
  <li>Banana</li>
</ul>

Example: Ordered List

<ol>
  <li>First</li>
  <li>Second</li>
</ol>
  1. First
  2. Second

2️⃣ Nested Lists 🌳

nested lists

You can nest lists inside other lists to show hierarchy.

<ul>
  <li>Fruits
    <ul>
      <li>Apple</li>
      <li>Banana</li>
    </ul>
  </li>
  <li>Vegetables
    <ul>
      <li>Carrot</li>
      <li>Broccoli</li>
    </ul>
  </li>
</ul>

3️⃣ Tables in HTML πŸ“Š

Tables organize data in rows and columns. Main tags:

Example: Simple Table

Simple Table
<table border="1">
  <tr>
    <th>Name</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>Alice</td>
    <td>24</td>
  </tr>
  <tr>
    <td>Bob</td>
    <td>30</td>
  </tr>
</table>
Name Age
Alice 24
Bob 30

Example: Table with Row and Column Span

Table with Row and Column Span
<table border="1">
  <tr>
    <th rowspan="2">Name</th>
    <th colspan="2">Scores</th>
  </tr>
  <tr>
    <td>Math</td>
    <td>Science</td>
  </tr>
  <tr>
    <td>Alice</td>
    <td>90</td>
    <td>95</td>
  </tr>
</table>
Name Scores
Math Science
Alice 90 95