Content
Images
Pictures never overflow their box — every image is at most 100% wide out of the box. These add captions, a soft frame, and pictures that switch with light and dark mode.
Responsive images
Nothing to add: an image shrinks to fit. Give it w-full to fill its box, an aspect ratio to keep its shape, and loading="lazy" so it only downloads when it's about to be seen.
<img src="../brand/moey-cat.png" alt="Moey the cat" class="w-full aspect-video object-contain bg-1 rounded-lg" loading="lazy">
Figure and caption
<figure class="figure max-w-xs">
<img src="../brand/moey-cat.png" alt="Moey the cat" class="figure-img w-full aspect-square object-contain bg-1">
<figcaption class="figure-caption">Moey, the cat behind the name.</figcaption>
</figure>
Frame
A soft panel around a picture instead of a hard border.
<span class="img-frame">
<img src="../brand/moey-cat.png" alt="Moey the cat" class="w-40 aspect-square object-contain">
</span>
A picture for each mode
Screenshots and diagrams often need a light and a dark version. Put both in and mark them light-only / dark-only — the right one shows, following the theme toggle, the system setting, or a section with its own data-mo-theme. Switch the mode at the top to see it change.
☀️ I'm the light version
🌙 I'm the dark version
follows the page
☀️ I'm the light version
🌙 I'm the dark version
a dark section
<img class="light-only" src="dashboard-light.png" alt="The dashboard" loading="lazy">
<img class="dark-only" src="dashboard-dark.png" alt="The dashboard" loading="lazy">
| Class | What it does |
|---|---|
figure · figure-img · figure-caption | a picture with a caption |
img-frame | a soft frame around a picture |
light-only · dark-only | shown only in that mode |
| Sizing and shape | see Sizing, Aspect ratio & object fit, Borders (rounded-lg · rounded-circle) |
| People | see Avatar |