Skip to content

Polaroid Photo Gallery

Pure CSS polaroid gallery on a cork board: tilted photo frames with tape and handwritten captions that straighten and lift on hover or focus.

Live preview

Open in new tab

Code

A scattered polaroid photo gallery built with pure CSS. Six square photos sit in white instant-film frames with handwritten captions and strips of washi tape, pinned at random-looking angles on a cork board. Hovering or focusing a photo straightens it, lifts it and brings it to the front. It works well for travel blogs, portfolio "about" pages, wedding sites and event recaps.

How it works

The root section.pl-board draws the cork texture with two speckled radial-gradient layers and an inset frame shadow. The photos live in a ul.pl-grid that uses two columns on phones and three from 720px. Every li.pl-item holds a figure.pl-photo with an img.pl-img and a figcaption.pl-caption.

The scattered look comes from two custom properties. Each .pl-item sets --pl-rotate and --pl-shift through :nth-child(6n + …) rules, so the pattern repeats cleanly if you add more photos, and no inline styles are needed. .pl-photo combines them in transform: translateY(var(--pl-shift)) rotate(var(--pl-rotate)). On :hover and :focus-visible the transform changes to rotate(0deg) scale(var(--pl-lift)), a deeper shadow is applied and z-index lifts the photo above its neighbours. A ::before pseudo-element draws the tape; even items get a blue strip with a different angle. No JavaScript is used.

The captions use the Caveat font from Google Fonts with a cursive fallback, and the square crop comes from aspect-ratio: 1 / 1 and object-fit: cover.

Customization

  • --pl-tilt on .pl-board: the base angle all rotations are multiplied from; 2deg gives a tidy board, 7deg a messy one.
  • --pl-lift: the zoom factor on hover, e.g. 1.15 for a stronger pop.
  • --pl-speed: duration of the straighten animation.
  • --pl-board-bg and the box-shadow on .pl-board: switch the cork for a dark slate or a plain wall color.
  • --pl-frame: the frame color; a warm #f5efe0 looks like aged film.
  • --pl-tape: color of the tape strips on odd items; edit the .pl-item:nth-child(even) .pl-photo::before rule for the even ones.
  • --pl-font: the caption font; remove the Google Fonts link if you prefer the system cursive fallback.
  • grid-template-columns in .pl-grid: show four columns on wide screens for larger collections.

Accessibility

The gallery is a real list, and each figure has a figcaption, so screen readers announce the caption with the photo. Every image has a descriptive alt, width, height, loading="lazy" and decoding="async". Frames have tabindex="0" so keyboard users get the same straightened view as mouse users, with a visible blue outline from --pl-focus. With prefers-reduced-motion: reduce the transition and the scaling are removed; the photo simply straightens. The dark caption ink on the white frame keeps strong contrast.

Usage notes

The photos come from Unsplash and should be replaced with your own images. Keep them square or let object-fit crop them. If the frames should open a larger view, wrap the image in a link and move tabindex off the figure.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Caveat:wght@500;700&display=swap">
Polaroid Photo Gallery – Pure CSS galleries component screenshot
Polaroid Photo Gallery · Pure CSS Galleries

More Galleries

Masonry Image Gallery – Pure CSS galleries preview

Masonry Image Gallery

Pure CSS masonry image gallery using multi-column layout, with hover and focus captions that slide up over each photo. No JavaScript needed.

Filterable Portfolio Gallery – Bootstrap 5 galleries preview

Filterable Portfolio Gallery

Dark Bootstrap 5 portfolio gallery with pill filter buttons, automatic category counts, fade-in tiles and a screen reader status message.

Gallery with Lightbox – Tailwind CSS galleries preview

Gallery with Lightbox

Tailwind CSS mosaic image gallery that opens an accessible lightbox with captions, arrow-key and swipe navigation, focus trap and preloading.