
A location card needs to communicate its place before it shows off its photography. Put a persistent overlay between the image and the label, then keep the label visible in every state. This example uses a real Country Club Plaza photograph and a subtle image zoom.
Change the CSS below. The preview updates as you type. Your edits stay in this browser tab.
Change the overlay opacity, image position, and scale. Keep the location readable.
HTML for this example
<a class="location-card" href="#location-result"><img src="https://webdesignkc.com/wp-content/plugins/wdkc-content-grids/assets/lab/plaza.jpg" alt="" width="1280" height="960"><span>Country Club Plaza<span class="location-card__detail">Explore the neighborhood →</span></span></a><p id="location-result" class="example-note">Demo destination. Photo: charvex (2008), public domain, via Wikimedia Commons. Cropped by CSS for this example.</p>
Separate the photo, overlay, and text
The photo fills the card with absolute positioning and object-fit: cover. A pseudo-element supplies the dark overlay. The label remains in normal grid layout, so long names can make the card taller. isolation: isolate keeps the negative layer values inside the card rather than behind the page.
Tune the crop and contrast together
Change object-position to keep the recognizable part of the photo in frame. Then adjust --overlay while checking the brightest area beneath the text. There is no one opacity value that works for every photo. Check each image, narrow-screen crop, and hover state; a text shadow alone does not guarantee readable contrast.
Keep the whole card understandable
Use one descriptive link and keep the place name visible on touch devices. The image has an empty alt attribute because the link’s visible label already identifies the place and the photo is decorative here. If an image supplies additional meaningful information, describe that information appropriately. Reduced-motion preferences remove the zoom transition.
See our location grid. Demo photo: Country Club Plaza by charvex, public domain; displayed with a CSS crop.
Reference: MDN on object-fit.
Have a client website that needs this kind of attention? See our WordPress development for agencies and case studies.


Leave a Reply