EDDYMENS

Published 4 months ago

How To Add A Caption To An Image In Markdown

sample markdown image [↗]

This is an image caption

Markdown unfortunately doesn't provide syntax for adding captions to images, however since HTML is a superset of Markdown we can use HTML to achieve this.

Some markdown parsers allow you to display the alt text of your images as captions. You should try that out first before going forward with this article.

How to Add Images in Markdown

First, let's see how you can add an image in Markdown.

The basic format to add an image is:

01: ![Alt text](image_url)
  • Alt text is the text that shows if the image doesn't load.
  • image_url is the link or path to your image file.

Adding Captions with HTML

We can use the P tag to add a caption underneath our image. We use the align=center attribute to center the caption to the center of the image.

01: ![Alt text](image_url) 02: 03: <p align="center"><em>This is an image caption</em></p>

Here is another article you might like 😊 What Are CSS Container Queries?