Skip to content
All Markdown syntax

Center text in Markdown

Text

Markdown syntax

Needs HTML
<p align="center">Centered text</p>

The usual way in GitHub READMEs.

Markdown has no alignment syntax. In a README the common fix is an HTML block with align="center", which GitHub keeps even though it strips style attributes. Inside a table, a colon on both sides of the divider centers that column.

All ways to write it

  • <p align="center">Centered text</p>
    The usual way in GitHub READMEs.Needs HTML
  • <div align="center">
    
    **Markdown inside**
    
    </div>
    Leave blank lines so the Markdown inside still renders.Needs HTML
  • | Title |
    |:-----:|
    | Centered cell |
    Centers text inside a table column only.GitHub Flavored Markdown

Example

You type

<p align="center">
  <strong>Yamuno docs</strong><br>
  Guides for Confluence and Jira admins
</p>

You get

Yamuno docs
Guides for Confluence and Jira admins

Questions

How do I center an image in a README?

Wrap it: <p align="center"><img src="logo.png" width="200"></p>.

Why is the Markdown inside my <div> not rendering?

Markdown inside an HTML block needs a blank line after the opening tag and before the closing tag.

Center text in Confluence

In Confluence, use the editor's alignment buttons on the paragraph. In a Markdown Macro+ macro, table columns aligned with :---: render centered, since the macro supports tables with alignment.

Related syntax

Also in Text

See all Markdown syntax