Creating Lists (<ul>, <ol>, <li>) and Nested Lists

Unordered List (<ul>) and List Item (<li>)

To create an unordered list (bulleted list) in Markdown, use - or *:

  <ul>
    <li>Item 1</li>
    <li>Item 2
        <ul>
            <li>Subitem 2.1</li>
            <li>Subitem 2.2</li>
        </ul>
    </li>
    <li>Item 3</li>
</ul>
  

This html code will render as:

  • Item 1
  • Item 2
    • Subitem 2.1
    • Subitem 2.2
  • Item 3

In this HTML representation:

  • <ul> is used to define an unordered list (bulleted list).
  • <li> is used for each list item.
  • Nested lists (<ul> within <li>) are used for subitems under “Item 2”.

Ordered List (<ol>) and List Item (<li>)

To create an ordered list (numbered list) in Markdown, use numbers followed by a period (.):

  <ol>
    <li>First item</li>
    <li>Second item</li>
    <li>Third item
        <ol>
            <li>Subitem 3.1</li>
            <li>Subitem 3.2</li>
        </ol>
    </li>
    <li>Fourth item</li>
</ol>
  

This html code will render as:

  1. First item
  2. Second item
  3. Third item
    1. Subitem 3.1
    2. Subitem 3.2
  4. Fourth item

In this HTML representation:

  • <ol> is used to define an ordered list (numbered list).
  • <li> is used for each list item. Nested lists (<ol> within <li>) are used for subitems under “Third item”.

Structuring Data with Tables (<table>, <tr>, <td>, <th>)

Creating a Table (<table>)

To create a table in Markdown, use pipe (|) to separate columns and hyphens (-) to separate the header row from the content rows:

  <table>
    <thead>
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Cell 1</td>
            <td>Cell 2</td>
        </tr>
        <tr>
            <td>Cell 3</td>
            <td>Cell 4</td>
        </tr>
    </tbody>
</table>
  

This html code will render as:

Header 1 Header 2
Cell 1 Cell 2
Cell 3 Cell 4

Table Structure

  • <table>: The main container for the table.
  • <tr>: Table row, defines a row of cells.
  • <th>: Table header cell, defines a header cell (typically bold and centered).
  • <td>: Table data cell, defines a cell with regular content.