Media
Responsive image, video, and embed frames with an optional caption.
Aspect Ratios
A ratio class locks the frame: 16:9 video, 4:3 photo, 1:1 thumbnail, 3:4 portrait. Without one the frame follows the picture.
html
<div class="vt-grid vt-grid-cols-2 vt-gap-4 vt-w-full vt-md:grid-cols-4 vt-items-start">
<figure class="vt-media">
<div class="vt-media-frame vt-media-video">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
<figcaption class="vt-media-caption">16:9 · vt-media-video</figcaption>
</figure><figure class="vt-media">
<div class="vt-media-frame vt-media-landscape">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
<figcaption class="vt-media-caption">4:3 · vt-media-landscape</figcaption>
</figure><figure class="vt-media">
<div class="vt-media-frame vt-media-square">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
<figcaption class="vt-media-caption">1:1 · vt-media-square</figcaption>
</figure><figure class="vt-media">
<div class="vt-media-frame vt-media-portrait">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
<figcaption class="vt-media-caption">3:4 · vt-media-portrait</figcaption>
</figure>
</div>
Image with Caption
A picture in a 16:9 frame with a figcaption under it.
html
<figure class="vt-media vt-w-full vt-max-w-md">
<div class="vt-media-frame vt-media-video">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
<figcaption class="vt-media-caption">A beautiful landscape photograph taken at sunset</figcaption>
</figure>
Video
Native HTML5 video in a 16:9 frame — the video fills it.
html
<figure class="vt-media vt-w-full vt-max-w-lg">
<div class="vt-media-frame vt-media-video">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<path d="M18.8906 12.846C18.5371 14.189 16.8667 15.138 13.5257 17.0361C10.296 18.8709 8.6812 19.7884 7.37983 19.4196C6.8418 19.2671 6.35159 18.9776 5.95624 18.5787C5 17.6139 5 15.7426 5 12C5 8.2574 5 6.3861 5.95624 5.42132C6.35159 5.02245 6.8418 4.73288 7.37983 4.58042C8.6812 4.21165 10.296 5.12907 13.5257 6.96393C16.8667 8.86197 18.5371 9.811 18.8906 11.154C19.0365 11.7084 19.0365 12.2916 18.8906 12.846Z" stroke="currentColor" stroke-linejoin="round" stroke-width="1.5"></path>
</svg>
</div>
</figure>
YouTube Embed
An embed iframe in a 16:9 frame, with a title and the allow attributes it needs.
html
<figure class="vt-media vt-w-full vt-max-w-lg">
<div class="vt-media-frame vt-media-video">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<path d="M15.9922 21H13.9922H9.99219H7.99219" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M10.4922 21V17M13.4922 17V21" stroke="currentColor" stroke-width="1.5"></path><path d="M15.9922 3H7.99219C5.16376 3 3.74955 3 2.87087 3.87868C1.99219 4.75736 1.99219 6.17157 1.99219 9V11C1.99219 13.8284 1.99219 15.2426 2.87087 16.1213C3.74955 17 5.16376 17 7.99219 17H15.9922C18.8206 17 20.2348 17 21.1135 16.1213C21.9922 15.2426 21.9922 13.8284 21.9922 11V9C21.9922 6.17157 21.9922 4.75736 21.1135 3.87868C20.2348 3 18.8206 3 15.9922 3Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M14.5682 9.235L11.1812 7.11812C11.0577 7.04093 10.915 7 10.7693 7C10.3401 7 9.99219 7.34793 9.99219 7.77712V12.2229C9.99219 12.6521 10.3401 13 10.7693 13C10.915 13 11.0577 12.9591 11.1812 12.8819L14.5682 10.765C14.832 10.6001 14.9922 10.311 14.9922 10C14.9922 9.68896 14.832 9.39985 14.5682 9.235Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
</svg>
</div>
</figure>
Image Gallery
Square thumbnails in a grid — one ratio keeps the rows even.
html
<div class="vt-grid vt-grid-cols-3 vt-gap-3 vt-max-w-lg">
<figure class="vt-media">
<div class="vt-media-frame vt-media-square">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
</figure><figure class="vt-media">
<div class="vt-media-frame vt-media-square">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
</figure><figure class="vt-media">
<div class="vt-media-frame vt-media-square">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
</figure><figure class="vt-media">
<div class="vt-media-frame vt-media-square">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
</figure><figure class="vt-media">
<div class="vt-media-frame vt-media-square">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M2.5 7H21.5" stroke="currentColor" stroke-linejoin="round" stroke-width="1.5"></path><path d="M2.5 17H21.5" stroke="currentColor" stroke-linejoin="round" stroke-width="1.5"></path><path d="M12 17L12 7" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M8 7L8 3M16 7L16 3" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M8 21L8 17M16 21L16 17" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
</svg>
</div>
</figure><figure class="vt-media">
<div class="vt-media-frame vt-media-square">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
</div>
</figure>
</div>
Avatar Image
A profile picture is an Avatar with an image, not a media frame.
html
<div class="vt-avatar vt-avatar-xl">
<img src="https://i.pravatar.cc/160?img=32" alt="Sarah Johnson" class="vt-w-full vt-h-full vt-object-cover">
</div>
<div class="vt-avatar vt-avatar-lg">
<img src="https://i.pravatar.cc/112?img=11" alt="Alex Chen" class="vt-w-full vt-h-full vt-object-cover">
</div>
<div class="vt-avatar vt-avatar-md">
<img src="https://i.pravatar.cc/80?img=47" alt="Maria Lopez" class="vt-w-full vt-h-full vt-object-cover">
</div>
Background with Overlay
Text over the picture on a dark fade.
html
<figure class="vt-media vt-w-full vt-max-w-lg">
<div class="vt-media-frame vt-media-video">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-media-icon" aria-hidden="true">
<circle cx="7.5" cy="7.5" r="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z" stroke="currentColor" stroke-width="1.5"></path><path d="M5 21C9.37246 15.775 14.2741 8.88406 21.4975 13.5424" stroke="currentColor" stroke-width="1.5"></path>
</svg>
<div class="vt-media-overlay">
<h3 class="vt-media-overlay-title">Featured Article</h3>
<p class="vt-media-overlay-text">A guide to building responsive media layouts</p>
</div>
</div>
</figure>
Guidelines
API Reference
| Class | Type | Description |
|---|---|---|
vt-media |
Base | The <figure> — bordered, radius 2xl, clips its frame; frame and caption stacked |
vt-media-frame |
Part | Holds the img, video or iframe, which fills it (object-fit: cover); empty, it is a subtle tint with the icon centered |
vt-media-video |
Modifier | On the frame: locks it to 16:9 (video, embeds, hero pictures) |
vt-media-landscape |
Modifier | On the frame: locks it to 4:3 (photos, product shots) |
vt-media-square |
Modifier | On the frame: locks it to 1:1 (gallery thumbnails) |
vt-media-portrait |
Modifier | On the frame: locks it to 3:4 (portraits, posters, book covers) |
vt-media-icon |
Part | Placeholder icon while there is no picture, 32px, muted |
vt-media-caption |
Part | The <figcaption> — Body/SM, muted, divider above |
vt-media-overlay |
Part | Text over the bottom of the frame on a dark fade, white |
vt-media-overlay-title |
Part | Overlay heading — Heading/SM |
vt-media-overlay-text |
Part | Overlay text — Body/SM, white at 80% |
Accessibility
| Feature | Details |
|---|---|
| Alt text | Every img carries meaningful alt; decorative media uses alt="" |
| Caption | figcaption is announced with its figure, so it can carry the description instead of repeating it in alt |
| Embeds | iframes get a title describing the embedded content |
| Overlay | Text on the dark fade is white; keep the picture behind it busy-free at the bottom so the text stays readable |
Built with