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 image element embeds responsive images with automatic sizing, lazy loading support, and visual variants for different use cases.
The <img> element is the primary way to embed images in HTML. Vanilla Breeze styles images to be responsive by default, constraining them to their container width while maintaining aspect ratio. Additional variant classes provide shapes, borders, and aspect ratio control.
Images are block-level elements with max-inline-size: 100% and block-size: auto, ensuring they never overflow their container while preserving their natural proportions.
.circle variant.full variantVanilla Breeze provides variant classes for common image treatments: .rounded, .circle, .thumbnail, .full, and aspect ratio classes like .ratio-square, .ratio-video, .ratio-portrait, and .ratio-landscape.
<img src="photo.jpg" alt="A scenic landscape photograph" />
<img src="photo.jpg" alt="..." class="rounded" />
<img src="avatar.jpg" alt="User name" class="circle" style="max-inline-size: 96px;" />
<img src="thumb.jpg" alt="..." class="thumbnail" />
<img src="banner.jpg" alt="..." class="full" />
| Class | Aspect Ratio | Use Case |
|---|---|---|
.ratio-square |
1:1 | Profile photos, app icons |
.ratio-video |
16:9 | Video thumbnails, hero images |
.ratio-portrait |
3:4 | Book covers, portraits |
.ratio-landscape |
4:3 | Classic photo format |
Control how images fit within constrained dimensions.
<!-- Contain: letterbox to fit --><img src="tall.jpg" alt="..." class="contain" style="max-block-size: 200px;" /> <!-- Cover: crop to fill --><img src="photo.jpg" alt="..." class="cover" style="block-size: 200px; inline-size: 100%;" />
Native lazy loading defers loading images until they approach the viewport, improving initial page load performance. Lazy-loaded images display a subtle background color while loading.
<!-- Lazy load images below the fold --><img src="photo.jpg" alt="..." loading="lazy" /> <!-- Eager load critical above-the-fold images --><img src="hero.jpg" alt="..." loading="eager" />
When an <img> is the direct child of an <a>, Vanilla Breeze automatically removes the underline decoration via a:has(> img) { text-decoration: none }. This prevents an unsightly underline bar beneath linked images.
<a href="/profile"> <img src="avatar.jpg" alt="View your profile" /></a>
See the <a> element docs for more on link styling and auto-detected link types.
Every image must have an alt attribute. The content depends on the image's purpose:
| Image Type | Alt Text Approach | Example |
|---|---|---|
| Informative | Describe the content and meaning | alt="Golden retriever playing fetch in a park" |
| Functional | Describe the action or destination | alt="Submit form" |
| Decorative | Empty alt attribute | alt="" |
| Complex | Brief summary + detailed description nearby | alt="Q3 sales chart. Details in table below." |
alt="" (not omitting the attribute)role="presentation" for purely decorative images<!-- Informative image --><img src="team.jpg" alt="The engineering team celebrating the product launch" /> <!-- Decorative image --><img src="divider.png" alt="" role="presentation" /> <!-- Functional image (link) --><a href="/profile"> <img src="avatar.jpg" alt="View your profile" /></a>
<picture> - Art direction and format switching with multiple sources<source> - Define image sources within picture element<figure> - Semantic wrapper for images with captions<figcaption> - Caption text for figures<svg> - Vector graphics and icons<a> - Image links with automatic underline removal<layout-card> - Cards that commonly contain images<compare-surface> - Before/after image comparison sliderStyles defined in /src/native-elements/image/styles.css
| Selector | Properties |
|---|---|
img |
max-inline-size: 100%; block-size: auto; display: block; |
img.rounded |
border-radius: var(--radius-m); |
img.circle |
border-radius: var(--radius-full); aspect-ratio: 1; object-fit: cover; |
img.thumbnail |
padding; background; border; border-radius; |
img.contain |
object-fit: contain; |
img.cover |
object-fit: cover; |
img[loading="lazy"] |
background: var(--color-surface-raised); |