Skip to content
Back to blog
Friday, December 4, 2026

How to Center Text in Markdown and Export It as PNG

Compare centered HTML paragraphs and Markdown table alignment, then download an event card from the live editor as a PNG.

How to Center Text in Markdown and Export It as PNG

To center a paragraph in Markdown, try <p style="text-align: center">Your text</p> in an editor that accepts raw HTML and inline CSS. For a table column, use :---: in the divider row. Markdown’s heading and paragraph syntax leave page alignment up to the renderer.

Compare a paragraph, HTML and a table

Paste the source below into the Markdown image converter. Copy the lines inside the code block into the editor without the outer fences. The heading and first paragraph give you a baseline. The next two lines test the older HTML align attribute and the CSS text-align property side by side.

# Text alignment check

Plain Markdown heading and paragraph

<p align="center">HTML alignment attribute</p>

<p style="text-align: center">Inline CSS alignment</p>

| Place | Time | Room |
| :--- | :---: | ---: |
| Check-in | 09:30 | B204 |

The first paragraph stays left aligned, both HTML examples sit in the middle, and the table aligns its three columns left, center and right.

In the production editor on December 4, 2026, both HTML paragraphs were centered in the preview and the downloaded 1340 × 678 PNG. The heading and plain paragraph started at the left edge. In the table, :--- aligned Place left, :---: centered Time, and ---: aligned Room right. The centering was relative to each cell. GitHub table alignment

Center the heading of a share card

Use HTML for the part of the card that needs centering. This example centers the event title, date and room. The instructions below the divider stay in an ordinary paragraph, which makes the longer sentence easier to read. Inside the HTML paragraph, <strong> adds emphasis and <br> starts a second line.

<h1 style="text-align: center">Community repair café</h1>

<p style="text-align: center"><strong>Saturday, 10:00–12:00</strong><br>Room B204 · East entrance</p>

---

Bring one small item and any matching parts. Check in by 10:30 so a volunteer has time to help.

The repair café card with a centered title, time and room, followed by left-aligned instructions and the converter footer.

Open the preview, check that the room and time fit, then choose Download image. The card shown here is the 1340 × 716 PNG downloaded directly from the converter. It includes the product footer. Open the file at the size you plan to share and check the title and the smallest text there, particularly if the card will appear in a phone chat.

Fix alignment that disappears in another editor

  • The tags appear on the page. Check for leftover fences or four leading spaces. If the tags still print literally, the editor may escape raw HTML.
  • The text displays but stays left. The editor may remove the style or align attribute. Test a one-line example in the destination preview. A plain Markdown heading or bold label is a portable fallback.
  • Only the table value moves. The divider markers align the contents of a column. To position the whole table or a card on the canvas, use a renderer with CSS layout controls.
  • Markdown emphasis looks like asterisks. In an HTML block, use <strong> or <em> for emphasis and separate the block from surrounding Markdown with blank lines. CommonMark HTML blocks

Choose the format for the destination

Keep the Markdown file alongside the image so the next person can edit the date or room. Paste the date and location as text alongside the PNG when people need to copy them. If the project needs fixed column widths, custom spacing, or a complete card layout, use the HTML to Image editor and define those dimensions in CSS.