Skip to content

Image Hover Effects

Six pure CSS image hover effects with captions: zoom, grayscale to color, sliding panel, tilt, blur and frame, also revealed by keyboard focus.

Also known as: image hover effect, hover caption gallery, grayscale to color hover, photo zoom on hover

Image Hover Effects live demo

Open in new tab

Pure CSS code (HTML, CSS)

Six image hover effects with captions, written in pure CSS without any JavaScript: zoom, grayscale to color, sliding panel, tilt, blur and an animated frame. Use them for portfolios, project galleries, blog archives, team pages and product category tiles.

How it works

The root section.ih-gallery holds a header and an .ih-grid of figure.ih-card elements. Each card contains an img.ih-img and a figcaption.ih-caption with an .ih-tag, an .ih-title, an .ih-text paragraph and an .ih-link. The caption is absolutely positioned over the image, and the tag stays visible at rest so every tile is labeled.

The effect is chosen with one modifier class per card:

  • .ih-card--zoom scales the image and slides the caption up on a dark gradient.
  • .ih-card--mono shows the photo in grayscale and fades in color and caption.
  • .ih-card--slide slides a tinted panel (a ::before on the caption) in from the left, with staggered text.
  • .ih-card--tilt rotates and scales the image while the caption pops in at the center.
  • .ih-card--blur blurs and darkens the photo while the title's letter spacing tightens.
  • .ih-card--frame draws a thin border in from the center using two pseudo-elements.

Every effect is triggered by :hover and by :focus-within, so keyboard users get the same reveal. The hidden state only applies inside @media (hover: hover); on touch screens the captions are always visible. The .ih-link has a stretched ::after, so the whole card is clickable.

Customization

  • src and alt of each .ih-img: replace the placehold.co placeholders with your own photos; object-fit: cover crops them to the 4:3 card.
  • aspect-ratio on .ih-card: use 1 for square tiles or 3 / 4 for portrait cards.
  • --ih-speed and --ih-ease on .ih-gallery: duration and easing of every transition.
  • --ih-overlay: the dark tint behind captions in the zoom and grayscale effects.
  • --ih-accent: the color of the sliding panel in .ih-card--slide.
  • --ih-radius: the corner radius of the cards.
  • --ih-focus: the color of the outline drawn around a focused card.
  • Swap the modifier class, e.g. .ih-card--zoom to .ih-card--frame, to use one effect for the whole grid.

Use cases

  • Portfolios: project photos zoom, tilt or blur on hover while a caption reveals the title
  • Team pages: black and white portraits turn to color with a short caption
  • Blog archives: whole-card links reveal a tag, title and link text on hover or focus
  • Product category tiles: six effects can be mixed, and touch screens always show the captions

Accessibility

Each figure uses a real figcaption, every image has descriptive alt text, and the link text names its target. Tabbing to a card's link reveals the caption through :focus-within and draws a visible outline around the card. Captions are never hidden from screen readers; they are only faded visually. With prefers-reduced-motion: reduce transitions become instant and images no longer zoom or rotate.

Usage notes

The grid shows one column on phones, two from 640px and three from 960px. The slide panel uses color-mix(), which is supported in all current browsers.

Image Hover Effects at a glance

Framework
Pure CSS
Code
HTML, CSS
JavaScript
Not needed, CSS only
Dependencies
None
Layout
Responsive, works on mobile
Category
Hover Effects
License
Free for personal and commercial use

Questions about this template

Can I use the Image Hover Effects code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

There is nothing to install. Paste the HTML where the component should appear and add the CSS to your stylesheet. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. It is built with HTML and CSS only, so there is no JavaScript to load.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

No dependencies. Pure HTML, CSS and JavaScript.

Image Hover Effects – free Pure CSS hover effect template
Image Hover Effects · free Pure CSS hover effect template

More Hover Effects

Link Underline Effects – free Pure CSS hover effect template

Link Underline Effects

Six animated link underline styles in pure CSS (slide, center, highlighter, ink fill, line swap and wave) that also work on links that wrap.

Magnetic Button Hover Effect – free Pure CSS hover effect template

Magnetic Button Hover Effect

Buttons that pull toward the mouse cursor when it comes near and spring back on leave, driven by CSS custom properties and a tiny script.