Markdown Tables

❮ Previous Home Next ❯

You can create a table by use three or more hyphens --- to create each column’s header, and use pipes | to separate each column.

The best practice that you should also add a pipe on either end of the row.

Syntax:

| | |
|-|-|
| | |
| | |

Example

| First Name | Last Name |
| ---------- | --------- |
| John       | Doe       |
| Jane       | Doe       |



Table Alignment

You can align text in the columns to the left, right, or center by adding a colon : to the left, right, or on both side of the hyphens within the header row.

Syntax:

|      |       |      |
| :--- | :---: | ---: |
|      |       |      |
|      |       |      |

Example

| First Name | Last Name | Age |
| :--- | :---: | ---: |
| John | Doe | 24 |
| Jane | Doe | 34 |



Formatting Text in Tables

You can format the text within tables. For example, you can add links, code (words or phrases in backticks ` only, not code blocks), and emphasis.

You can’t use headings, blockquotes, lists, horizontal rules, images, or most HTML tags.

Example

| First Name | Last Name | Age |
| :--- | :---: | ---: |
| **John** | Doe | 24 |
| *Jane* | `Doe` | 34 |






Adding Lists Within Table Cells

You can add a list within a table cell by using HTML tags, as shown in following example:

Example

| First Name | Last Name | Age |
| :--- | :---: | ---: |
| John | Doe | 24 |
| Jane | Doe | 34 <ul><li>one</li><li>two</li></ul> |



Adding Line Breaks Within Table Cells

You can break paragraphs within a table cell by using one or more <br> HTML tags.

Example

| First Name | Last Name | Age |
| :--- | :---: | ---: |
| John | Doe | 24 |
| Jane | Doe | 34 <br> line Breaked |



If you want escaping pipe characters to display a | character in a table by using its HTML character code |.

Example

&#124; This would not be act as table



You can create table by using html table elements.

Example

<table>
 <tr>
  <th>First Name</th>
  <th>Last Name</th>
  <th>Age</th>
 </tr>
 <tr>
  <td>John</td>
  <td>Doe</td>
  <td>24</td>
 </tr>
 <tr>
  <td>Jane</td>
  <td>Doe</td>
  <td>34</td>
 </tr>
</table>

Related Pages

HTML reference: HTML table tutorial

HTML reference: HTML <table> tag

HTML reference: HTML <tr> tag

HTML reference: HTML <th> tag

HTML reference: HTML <td> tag

❮ Previous Home Next ❯