Change text to an image on hover or focus

Text-to-image hover playground

Hover a card, Tab to its link, or enable the preview switch. Select a card to jump to its sample description. On touchscreens, illustrations and labels stay visible.

Preview mode
Explore the coast
Coast: cliffs and turquoise water.
Explore the mountains
Mountains: snow peaks and a lake.
Explore the forest
Forest: evergreen trees and hills.

Coastal illustration

A flat-color coastal scene. The image is a decorative preview; this heading remains a normal link destination.

Alpine illustration

A mountain-and-lake illustration. Keyboard focus reveals the same preview as pointer hover.

Forest illustration

An evergreen scene. On a touchscreen, the image and caption are visible without requiring hover.

Pure HTML and CSS. No JavaScript, framework, account or external image service is required.