Skip to content

Text Alignment

Column alignment is controlled by placing colons (:) in the separator row.

Separator Alignment
--- Default (no alignment style)
:--- Left
:---: Centre
---: Right

No alignment

| A | B |
| - | - |
| 1 | 2 |
A B
1 2
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
</tbody>
</table>

Left alignment

| Item     |
| :------- |
| Apple    |
| Banana   |
Item
Apple
Banana
<table>
<thead>
<tr>
<th style="text-align:left">Item</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">Apple</td>
</tr>
<tr>
<td style="text-align:left">Banana</td>
</tr>
</tbody>
</table>

Centre alignment

| Score  |
| :----: |
| 42     |
| 100    |
Score
42
100
<table>
<thead>
<tr>
<th style="text-align:center">Score</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">42</td>
</tr>
<tr>
<td style="text-align:center">100</td>
</tr>
</tbody>
</table>

Right alignment

| Price  |
| -----: |
| $9.99  |
| $14.99 |
Price
$9.99
$14.99
<table>
<thead>
<tr>
<th style="text-align:right">Price</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">$9.99</td>
</tr>
<tr>
<td style="text-align:right">$14.99</td>
</tr>
</tbody>
</table>

Mixed alignment

| Item      | Value  | Qty  |
| :-------- | -----: | :--: |
| Computer  | $1600  |  1   |
| Phone     |   $12  |  5   |
| Pipe      |    $1  | 200  |
Item Value Qty
Computer $1600 1
Phone $12 5
Pipe $1 200
<table>
<thead>
<tr>
<th style="text-align:left">Item</th>
<th style="text-align:right">Value</th>
<th style="text-align:center">Qty</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">Computer</td>
<td style="text-align:right">$1600</td>
<td style="text-align:center">1</td>
</tr>
<tr>
<td style="text-align:left">Phone</td>
<td style="text-align:right">$12</td>
<td style="text-align:center">5</td>
</tr>
<tr>
<td style="text-align:left">Pipe</td>
<td style="text-align:right">$1</td>
<td style="text-align:center">200</td>
</tr>
</tbody>
</table>

Note

Alignment from the separator row applies to every body row in the column, including the header cell.