Markdown Table Alignment: Left, Center and Right Columns
You can choose how each table column lines up. In the separator row (the second row), add colons: :--- for left, :---: for centre and ---: for right. Numbers usually read best on the right.
The rule
In the second row of a table, colons set how each column lines up: :--- on the left, :---: in the centre, ---: on the right.
You type
| Item | Qty |
| :--- | ---: |
| Hat | 1 |You get
| Item | Qty |
|---|---|
| Hat | 1 |
Try it yourself
Make a table with the headers Dino and Size and one row: T-Rex, Huge. Put the Size column in the centre.
Live preview
More examples
You type
| Item | Qty |
| :--- | ---: |
| Hat | 1 |
| Water bottles | 12 |You get
| Item | Qty |
|---|---|
| Hat | 1 |
| Water bottles | 12 |
Words on the left, numbers on the right.
You type
| Dino | Size |
| :---: | :---: |
| T-Rex | Huge |You get
| Dino | Size |
|---|---|
| T-Rex | Huge |
Both columns centred.
Common mistakes
You type
| Item | Qty |
| --- | --- |
| Hat | 1 |Shows as
| Item | Qty |
|---|---|
| Hat | 1 |
No colons, so both columns use the default (left).
You type
| Item | Qty |
| ---: | :--- |
| Hat | 1 |Shows as
| Item | Qty |
|---|---|
| Hat | 1 |
The colons are swapped: this puts Item on the right and Qty on the left.
Where it works
Wherever tables work: GitHub, Obsidian, Notion, VS Code and most modern apps.
Keep it, not just learn it
The full course has 22 skills on five islands, short Missions that check your answers, and reviews a few days later so it sticks. Free, no sign-up.