Izmir is a small CSS library for building image hover effects. A base class supplies the component; additional classes control the image, border, caption and layout. You can combine those pieces without writing a separate animation for every card.
This is an independently maintained reference to Ciaran Walsh’s open-source Izmir project. The library and its original copyright notice are available below under the MIT license. The examples on this page are new demonstrations using this journal’s illustrations.
Try the effects
Move the pointer over a card, or use the Tab key to focus it. Each example combines a different border, image and caption treatment. These are demonstrations, not navigation links.
A closer look
Zoom the image; bring the caption upward.
Change the emphasis
Use position to give a caption room.
Add a small surprise
Keep the movement secondary to the message.
The useful distinction: one component, several decisions
A card can look different without needing a different HTML structure. Start with the c4-izmir class on a figure, put an image inside it, and add a figcaption. Then decide what should change when the card receives attention.
| Decision | Example class | What to examine |
|---|---|---|
| Move the artwork | c4-image-zoom-in |
Does the crop still preserve the important subject? |
| Frame the card | c4-border-bottom |
Does the border guide attention without resembling a loading indicator? |
| Introduce the caption | c4-fade-up |
Can the caption be read comfortably once it appears? |
| Position the content | c4-layout-bottom-left |
Does the text have enough space at the narrowest screen size? |
For a portfolio tile, a modest zoom and a short caption may be enough. A dense product card needs a different judgment: price, availability and the main action should already be visible. An animation can support that information, but should not be its only route into view.
A minimal example
Load the stylesheet once, then add the component. Replace the image path and text with your own content.
<link rel="stylesheet" href="/wp-content/restoration/izmir/izmir.min.css">
<figure class="c4-izmir c4-border-bottom c4-image-zoom-in" tabindex="0">
<img src="your-image.webp" alt="Describe the image" width="800" height="600">
<figcaption>
<h3 class="c4-fade-up">A short caption</h3>
</figcaption>
</figure>
The tabindex in this example makes the demonstration focusable. A real link or button should retain its native element and a meaningful accessible name. Do not turn an entire application into a sequence of focusable decorative pictures.
Make it work beyond a mouse
Try the card with a keyboard, on a touch screen and with reduced motion enabled. Check these cases separately: a visually convincing hover state is only one part of the interaction.
- Keep essential information visible when the device has no hover capability.
- Give links and buttons a visible focus treatment, and test their actual destination or action.
- Use a reduced-motion override if the animation is unnecessary to understanding the content.
- Check long captions and translated text. A fixed-height card can conceal overflow even when the short demonstration works.
This page adds a small accessibility stylesheet around the original library: captions remain visible on devices without hover, keyboard focus has an outline, and reduced-motion preferences suppress the transitions. Those adjustments belong to the examples here; they are not a claim that every use of the upstream library is automatically accessible.
Files, attribution and next steps
- Download the local Izmir stylesheet.
- Read the MIT license and original copyright notice.
- Inspect the upstream source and original documentation.
- Follow the step-by-step setup and troubleshooting guide.
Build one working card before creating a grid. Once the image, caption, focus and touch behavior all work together, reuse that component with different content.