Destination Highlight Card

Showcase travel destinations or featured locations with this visually immersive and elegant highlight card.

This design prioritizes a high-quality image by making it the full background of the card. The destination's name and country are overlaid on top, using a subtle gradient to ensure the text is always clear and readable.

Screenshot of three destination cards with beautiful travel photos and overlaid text.

Get Source Code Preview

About this Component

This component uses CSS positioning and layering to make the entire card a single, clickable link leading to more details about the location. On hover, the background image subtly zooms in to provide a rich, interactive experience. The text overlay remains stationary at the bottom, creating a clean effect.

Features

Code Breakdown

HTML Structure

The card is an article. Inside, a single anchor tag (a) wraps all the visible elements (the background img and a div) for the textual content. The destination name is an h3 with a unique id that is referenced by the link's aria-labelledby attribute for accessibility.

CSS Styling

The card (.dest-card) is set to position: relative, which serves as the positioning context. The a tag inside is a flex container that fills the entire card. The img element is then absolutely positioned with inset: 0 to fill the entire card, and given a low z-index: 1 to sit at the back. A CSS pseudo-element (::before) on the link creates the gradient overlay and is given a z-index: 2 to sit above the image. Finally, the content div is given a position: relative and a higher z-index: 3, which ensures it always appears on top of the image and the gradient.

Code

Here's the complete, self-contained code. This component is perfect for building a visually-driven gallery of places.

View Output