The standard way to put text directly under an image in HTML is to use the <figure> element with a <figcaption> element. <figure> groups the image and its caption as one semantic unit, while <figcaption> identifies the text as the caption for that figure. This is preferable to placing an image and an unrelated paragraph together when the text specifically describes the image.
The Correct HTML
Use this structure:
<figure>
<img src="image.jpg" alt="A description of the image">
<figcaption>This text appears under the image.</figcaption>
</figure>
The <img> displays the image, and <figcaption> supplies the visible text below it. By default, the caption follows the image in the normal document flow, so you do not need JavaScript or positioning just to place text underneath. The <figcaption> can be the first or last child of <figure>, although putting it after the image is the common pattern for a caption below the image.
Use CSS to Control the Appearance
HTML provides the structure; CSS controls how the image and caption look:
<figure class="image-caption">
<img src="image.jpg" alt="A mountain landscape">
<figcaption>A mountain landscape at sunset.</figcaption>
</figure>
.image-caption {
max-width: 500px;
margin: 20px auto;
text-align: center;
}
.image-caption img {
display: block;
width: 100%;
height: auto;
}
.image-caption figcaption {
margin-top: 8px;
font-size: 14px;
color: #555;
}
text-align: center centers the caption, margin-top adds space between the image and text, and width: 100% with height: auto keeps the image responsive inside the figure. You can change the font, size, color, spacing, and alignment with CSS.
Why <figure> and <figcaption> Are Better
You can also write:
<img src="image.jpg" alt="A mountain landscape">
<p>A mountain landscape at sunset.</p>
This may display the text underneath, but the paragraph is not explicitly identified as the caption belonging to the image. <figure> and <figcaption> communicate that relationship in the document structure, which is useful for browsers and assistive technologies.
The semantic structure is especially appropriate for independent content such as photographs, charts, diagrams, illustrations, and screenshots that are referenced by the surrounding article.
Do Not Use title as the Caption
A common mistake is using the title attribute:
<img src="image.jpg" alt="A mountain landscape" title="A mountain landscape at sunset">
This does not create visible text underneath the image. The title attribute may provide supplementary information as a browser tooltip, but it is not a replacement for a caption or alt text. When an image needs a caption, use <figure> and <figcaption>.
alt Text and Caption Text Are Different
A caption and alt text have different roles. The alt attribute provides alternative text for the image, while the caption provides visible context for the figure. They should not automatically contain the same sentence.
For example:
<figure>
<img
src="team-photo.jpg"
alt="Five developers standing in front of a whiteboard">
<figcaption>
The development team after the 2026 product release.
</figcaption>
</figure>
The alt text describes what is visible in the image, while the caption explains its context in the page.
Keep a Normal Caption in Normal Document Flow
For text that should simply appear underneath the image, do not use absolute positioning, negative margins, or JavaScript. Keep the caption after the image inside the <figure>:
<figure>
<img src="photo.jpg" alt="A city skyline">
<figcaption>City skyline at night</figcaption>
</figure>
Then control the spacing with CSS:
figcaption {
margin-top: 6px;
text-align: center;
}
This is simpler and more reliable across different screen sizes.
If You Mean Text Over the Image
Text under an image is different from text on top of an image. A normal caption belongs below the image in document flow. An overlay requires CSS positioning and a different layout structure.
Final Answer
Use <figure> and <figcaption> when the text is a caption for an image:
<figure>
<img src="image.jpg" alt="Description of the image">
<figcaption>Caption text goes here.</figcaption>
</figure>
Use CSS to control alignment, spacing, typography, and responsive sizing. This is the semantic HTML pattern specifically designed to associate a caption with a figure.
Why Not Read This?
How To Add Schema Markup To Html
How To Call A Function In Javascript From Html
How To Center An Iframe In Html
How To Change Plain Text Email To Html
How To Make Text Wrap Around An Image In Html
Are Html And Css Programming Languages
Do My Html Homework
How To Add Alt Tags To Images In Html
How To Create Multiple Web Pages In Html
How To Import An Html File Into Excel
