Markdown Text Alignment Guide
Markdown is lightweight markup language that offers simplicity alongside a bunch of powerful features. One of such features is text alignment. While originally, Markdown doesn?t support text alignment explicitly, we often need to adjust the alignment of our text when writing documentation. This tutorial is all about explaining different ways to align your text in Markdown. We will cover left alignment, right alignment, and center alignment.
Aligning Text in Markdown
Markdown does not natively support text alignment. However, we can use HTML ways within our Markdown to align our text. Remember, good markdown rendering softwares should be able to interpret simple HTML.
Left Alignment
By default, all the text in Markdown is left-aligned. You do not need to do anything special to left-align your text. However, if you want to explicitly mention it, you can use <p align="left">
HTML tag.
<p align="left">Your text here</p>
This code will render as follows:
Your text here
Right Alignment
Right alignment can be achieved by using the <p align="right">
HTML tag.
<p align="right">Your text here</p>
This code will render as follows:
Your text here
Center Alignment
Center alignment can be achieved by using the <p align="center">
HTML tag.
<p align="center">Your text here</p>
This code will render as follows:
Your text here
Aligning Text in Tables
When creating tables in markdown, you can specify the alignment of each column. The alignment is determined by colons :
in the table header.
- Use it on the left to align text to the left,
- Use it on the right to align text to the right,
- Use it on both sides for center alignment.
In the following table, the text in the columns will be: left-aligned
, right-aligned
, and center-aligned
respectively.
| Left Align | Right Align | Center Align |
| :--- | ---: | :---: |
| Cell 1A | Cell 1B | Cell 1C |
| Cell 2A | Cell 2B | Cell 2C |
This code will render as follows:
Left Align | Right Align | Center Align |
---|---|---|
Cell 1A | Cell 1B | Cell 1C |
Cell 2A | Cell 2B | Cell 2C |
That’s it! Now you are adept in manipulating markdown for text alignment. Remember Markdown is not only about writing content but also about designing that content for a better user experience. For even more ways to get the most out of Markdown, check out our ‘Ultimate Guide’ on the subject. Happy writing!