Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
The figure element represents self-contained content with an optional caption, used for images, diagrams, code snippets, and quotations.
The <figure> element represents self-contained content that is referenced from the main content but could be moved to an appendix or sidebar without affecting the document flow. It typically contains images, diagrams, code listings, or quotations along with an optional <figcaption>.
Vanilla Breeze provides variants for bordered figures, floating figures, code examples, and pull quotes.
Basic figure with content and optional caption.
<figure> <img src="landscape.jpg" alt="A scenic landscape" /> <figcaption>A beautiful mountain landscape at sunset.</figcaption></figure>
Adds padding and border for a card-like appearance with separated caption.
<figure class="bordered"> <img src="photo.jpg" alt="..." /> <figcaption>Caption with border separator.</figcaption></figure>
Centers the figure and caption for standalone display.
<figure class="centered"> <img src="photo.jpg" alt="..." style="max-inline-size: 400px;" /> <figcaption>A centered figure with centered caption.</figcaption></figure>
Floats the figure to the start (left in LTR) with text wrapping.
<figure class="float-start" style="max-inline-size: 200px;"> <img src="photo.jpg" alt="..." /> <figcaption>Caption text</figcaption></figure><p>Text wraps around the figure...</p>
Floats the figure to the end (right in LTR) with text wrapping.
<figure class="float-end" style="max-inline-size: 200px;"> <img src="photo.jpg" alt="..." /> <figcaption>Caption text</figcaption></figure><p>Text wraps around the figure...</p>
Full container width.
<figure class="full"> <img src="panorama.jpg" alt="..." /> <figcaption>A full-width figure spanning the entire container.</figcaption></figure>
Styled for code examples with filename in caption.
function greet(name) {
return `Hello, ${content}#123;name}!`;
}
console.log(greet('World'));
<figure class="code"> <pre><code>function greet(name) { return `Hello, ${name}!`;}</code></pre> <figcaption>example.js</figcaption></figure>
Styled for pull quotes with attribution.
The only way to do great work is to love what you do.
<figure class="quote"> <blockquote> The only way to do great work is to love what you do. </blockquote> <figcaption>Steve Jobs</figcaption></figure>
When a figure contains a horizontally-scrollable element like a wide table or code block, the <figcaption> automatically stays anchored at the left edge while the content scrolls. This is applied automatically — no class or attribute needed.
const config = { entry: "./src/index.js", output: { path: "/dist", filename: "bundle.js" }, module: { rules: [{ test: /\.css$/, use: ["style-loader", "css-loader"] }] } };
Figures can contain various types of content beyond images.
<figure> <img src="photo.jpg" alt="Example image" /> <figcaption>Figure 1: A sample image with caption.</figcaption></figure>
<figure> <picture> <source media="(min-width: 600px)" srcset="photo-wide.jpg" /> <img src="photo-narrow.jpg" alt="Responsive image" /> </picture> <figcaption>Figure 2: A responsive image using the picture element.</figcaption></figure>
Use the poster attribute and a fallback paragraph for browsers without video support.
<figure> <video controls preload="none" poster="poster.jpg"> <source src="intro.mp4" type="video/mp4" /> <p>Your browser does not support the video element. <a href="intro.mp4">Download the video</a> instead.</p> </video> <figcaption>Figure 3: Introduction video with playback controls.</figcaption></figure>
Canvas elements require JavaScript to draw content. The figure wraps the canvas and provides a caption describing the visualization.
<figure> <canvas id="chart" width="500" height="260"></canvas> <figcaption>Figure 4: Quarterly revenue (thousands).</figcaption></figure>
Inline SVG diagrams benefit from role="img" and an aria-label for accessibility.
<figure> <svg viewBox="0 0 400 100" role="img" aria-label="Five squares showing decreasing opacity"> <rect x="10" y="20" width="60" height="60" fill="var(--color-interactive)" rx="4" /> <rect x="90" y="20" width="60" height="60" fill="var(--color-interactive)" rx="4" opacity="0.8" /> <rect x="170" y="20" width="60" height="60" fill="var(--color-interactive)" rx="4" opacity="0.6" /> <rect x="250" y="20" width="60" height="60" fill="var(--color-interactive)" rx="4" opacity="0.4" /> <rect x="330" y="20" width="60" height="60" fill="var(--color-interactive)" rx="4" opacity="0.2" /> </svg> <figcaption>Figure 5: SVG diagram showing opacity progression.</figcaption></figure>
Wrap iframes in a responsive container to maintain aspect ratio. Always include a descriptive title attribute.
<figure> <div class="embed-responsive"> <iframe src="page.html" title="Embedded content"></iframe> </div> <figcaption>Figure 6: Embedded external content.</figcaption></figure>
Native audio controls render even without a source file. Include a fallback message for older browsers.
<figure> <audio controls> <source src="podcast.mp3" type="audio/mpeg" /> <p>Your browser does not support the audio element.</p> </audio> <figcaption>Audio 1: Podcast episode — "Introduction to Web Development"</figcaption></figure>
The <figure> element has an implicit figure role when it contains a <figcaption>. Screen readers announce it as a figure with its caption.
The alt attribute and <figcaption> serve different purposes:
alt - Describes the image content for screen readersfigcaption - Provides context visible to all users<figure> <!-- alt describes WHAT the image shows --> <img src="chart.png" alt="Bar chart comparing Q1-Q4 sales" /> <!-- figcaption provides CONTEXT about why it's shown --> <figcaption>Figure 1: Q4 sales exceeded targets by 15%.</figcaption></figure>
alt text on images within figuresalt and figcaptionfigcaption for context, attribution, or additional details<figcaption> - Caption element for figures<img> - Images within figures<picture> - Responsive images within figures<video> - Videos within figures<audio> - Audio within figures<canvas> - Canvas graphics within figures<svg> - SVG diagrams within figures<blockquote> - Quotations within figuresStyles defined in /src/native-elements/figure/styles.css
| Selector | Properties |
|---|---|
figure |
display: block; margin: 0; |
figure > img/video/picture/iframe/canvas |
display: block; inline-size: 100%; block-size: auto; |
figure.bordered |
padding; border; border-radius; |
figure.centered |
margin-inline: auto; text-align: center; |
figure.float-start |
float: inline-start; max-inline-size: 50%; |
figure.float-end |
float: inline-end; max-inline-size: 50%; |
figure.code |
Special pre/code/figcaption styling; |
figure.quote |
Special blockquote/figcaption styling; |
figure:has(:is(table, pre)) > figcaption |
position: sticky; inset-inline-start: 0; |