Toggle navigation
☰
Home
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <!-- Place the following CSS in your <head> or stylesheet --> <style> /* This is an optional body style to provide a background for the page */ body { background-color: #f0f0f0; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; } /* === Grid Container for the Cards === */ .cards-grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; padding: 1.5rem; } /* === Destination Card Styles === */ .dest-card { --dest-card-radius: 12px; --dest-card-height: 380px; position: relative; display: block; height: var(--dest-card-height); border-radius: var(--dest-card-radius); overflow: hidden; color: #ffffff; box-shadow: 0 4px 12px rgba(0,0,0,0.15); } /* The stretched link itself is the main container for content */ .dest-card-link { display: flex; flex-direction: column; justify-content: flex-end; /* Pushes content to the bottom */ position: relative; width: 100%; height: 100%; text-decoration: none; color: inherit; } /* Background Image */ .dest-card-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; /* Sits at the back */ transition: transform 0.4s ease; } .dest-card:hover .dest-card-image { transform: scale(1.05); } /* Gradient Overlay */ .dest-card-link::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%); z-index: 2; /* Sits above the image */ } .dest-card-content { position: relative; z-index: 3; /* Sits on top of everything */ padding: 1.5rem; } .dest-card-name { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin: 0 0 0.5rem; } .dest-card-country { font-size: 1rem; font-weight: 500; opacity: 0.9; } </style> <!-- Place the following HTML in your <body> --> <div class="cards-grid-container"> <!-- Card 1 --> <article class="dest-card"> <a href="#" class="dest-card-link" aria-labelledby="dest-name-1"> <!-- Image by placehold.co. Replace with your own. --> <img class="dest-card-image" src="https://placehold.co/600x800/a5b4fc/ffffff/png?text=Hallstatt" alt="Dramatic mountains and lake scenery in Hallstatt, Austria."> <div class="dest-card-content"> <h3 class="dest-card-name" id="dest-name-1">Hallstatt</h3> <p class="dest-card-country">Austria</p> </div> </a> </article> <!-- Card 2 --> <article class="dest-card"> <a href="#" class="dest-card-link" aria-labelledby="dest-name-2"> <!-- Image by placehold.co. Replace with your own. --> <img class="dest-card-image" src="https://placehold.co/600x800/7dd3fc/ffffff/png?text=Santorini" alt="The iconic blue-domed churches of Santorini, Greece."> <div class="dest-card-content"> <h3 class="dest-card-name" id="dest-name-2">Santorini</h3> <p class="dest-card-country">Greece</p> </div> </a> </article> <!-- Card 3 --> <article class="dest-card"> <a href="#" class="dest-card-link" aria-labelledby="dest-name-3"> <!-- Image by placehold.co. Replace with your own. --> <img class="dest-card-image" src="https://placehold.co/600x800/fca5a5/ffffff/png?text=Portofino" alt="Vibrant cityscape of Portofino, Italy with colorful buildings."> <div class="dest-card-content"> <h3 class="dest-card-name" id="dest-name-3">Portofino</h3> <p class="dest-card-country">Italy</p> </div> </a> </article> </div>