StealThis .dev

Real Estate — Listing Card

An editorial real-estate listing card built with vanilla HTML, CSS, and JavaScript. Each card pairs a gradient property photo with a carousel dot row, a persistent favorite-heart toggle, and a status ribbon for new, for-sale, or pending homes. A serif price headline sits above a beds, baths, and square-footage stat row, an address line, and an agent and brokerage footer. Shown as a responsive four-card grid with hover lift, smooth micro-interactions, and accessible keyboard controls.

Відкрити в Lab
html css vanilla-js
Цілі: JS HTML

Код

Listing Card

A reusable, editorial-feeling listing card for property collections. Each card opens with a large simulated property photo rendered from layered CSS gradients — warm, sky, dusk, and garden moods — topped with a status ribbon (New, For Sale, or Pending) and a translucent favorite heart. A serif price headline anchors the body, followed by a beds·baths·sqft stat row, the street address, and an agent-and-brokerage footer. Four cards are arranged in a responsive auto-fill grid that collapses to a single column on small screens.

The interactions are pure vanilla JavaScript. Clicking the photo or the dot row cycles through the listing’s gradient “photos,” with the active dot expanding into a pill and arrow keys supported while the media region is focused. The heart toggles a saved state that animates with a small pop, fires a toast confirmation, and persists to localStorage so favorites survive a reload. A startup toast quietly reports how many saved listings were restored.

Everything is self-contained with no build step or external libraries — just the two Google Fonts, a single stylesheet, and one script. Controls expose aria-pressed, aria-selected, and descriptive labels, and a prefers-reduced-motion block disables the lift and pop animations for visitors who ask for less movement.

Illustrative UI only — sample listings and data are fictional; not a real real-estate service.