0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
The figcaption element provides a caption or legend for the content of its parent figure element.
Description
The <figcaption> element represents a caption or legend describing the contents of its parent <figure> element. It can appear as the first or last child of the figure, and there can only be one figcaption per figure.
Vanilla Breeze styles figcaption with muted text color and smaller font size, with variants for alignment and visibility.
When to Use
Image descriptions - Explain what an image shows or why it's relevant
Photo credits - Attribution for photographers or image sources
Figure numbering - "Figure 1:", "Chart 2:", etc.
Code file names - Identify the source file for code examples
Quote attribution - Identify the source of a quotation
Data sources - Credit the source of chart or graph data
Placement
Figcaption can appear at the beginning or end of a figure. VB adapts the spacing to the position: a trailing caption gets space above it, a leading caption gets space below it (and .bordered / .code figures move their divider and rounded corners to match).
Caption After Content (Default)
Caption after content
<figure><imgsrc="photo.jpg"alt="..." /><figcaption>Caption after content</figcaption></figure>
Caption Before Content
Caption before content
<figure><figcaption>Caption before content</figcaption><imgsrc="photo.jpg"alt="..." /></figure>
Variants
Alignment: default, .centered, .end
Captions are start-aligned by default (left in LTR). .centered centers them; .end aligns them to the inline end (right in LTR, left in RTL).
Keeps the caption in the accessibility tree — it still names the figure — without showing it. The declarations are identical to the .visually-hidden utility, so class="visually-hidden" works the same way.
Visually hidden caption
<figure><imgsrc="chart.png"alt="Bar chart of monthly sign-ups, rising from 40 to 120" /><figcaptionclass="hidden">Figure 4: Sign-ups tripled in the first half of the year.</figcaption></figure>
Caption Content
Figcaption accepts flow content: numbering, links, citations, and even multiple paragraphs.
Caption content
<figcaption><strong>Figure 1:</strong> Mountain landscape at sunset.</figcaption><figcaption>Photo by <ahref="https://example.com/photographers/jane-doe">Jane Doe</a>.</figcaption><figcaption><cite>The Great Wave off Kanagawa</cite> by Hokusai, c. 1831.<small>Source: Metropolitan Museum of Art</small></figcaption>
For automatic “Figure N:” prefixes, put the figures inside <article data-numbered> instead of typing the numbers.
Context-Specific Captions
In code figures the caption usually shows the filename; in quote figures it carries the attribution (with a leading dash); for media it can link to a transcript.
Accessibility
Role in Accessibility
A <figure> always has the figure role. Per HTML-AAM, its first <figcaption> child provides the figure's accessible name, so assistive technology can identify the figure by its caption when a user reaches it. Exactly how and when the caption is spoken depends on the screen reader and browser.
Alt Text vs Figcaption
These serve different purposes and shouldn't duplicate each other:
<!-- Good: Different information in each --><figure><imgsrc="chart.png"alt="Bar chart showing sales increasing from $10M in Q1 to $15M in Q4" /><figcaption> Figure 2: Sales exceeded projections in all quarters.</figcaption></figure><!-- Bad: Duplicate information --><figure><imgsrc="chart.png"alt="Sales exceeded projections in all quarters" /><figcaption> Sales exceeded projections in all quarters.</figcaption></figure>
Visually Hidden Captions
Use .hidden (or .visually-hidden) only when a meaningful figure needs a name but the visual design has no room for a caption. Decorative images don't belong in a <figure> at all — give them alt="" and leave them out of the accessibility tree.
Related
<figure> - Parent element that contains figcaption