UI Components Easy
Map Embed Card
Map embed card with OpenStreetMap iframe, location pin overlay, address text, and directions CTA. No API key needed.
Open in Lab
MCP
html css
Targets: JS HTML
Code
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: #f9fafb;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 32px 16px;
}
.demo {
width: 100%;
max-width: 480px;
}
.map-card {
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 20px;
overflow: hidden;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.map-header {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 20px 20px 16px;
}
.map-icon {
font-size: 24px;
flex-shrink: 0;
margin-top: 2px;
}
.map-title {
font-size: 16px;
font-weight: 800;
color: #111827;
margin-bottom: 3px;
}
.map-address {
font-size: 13px;
color: #6b7280;
line-height: 1.5;
}
.map-frame {
width: 100%;
height: 240px;
overflow: hidden;
border-top: 1px solid #f3f4f6;
border-bottom: 1px solid #f3f4f6;
}
.map-frame iframe {
width: 100%;
height: 100%;
border: none;
display: block;
}
.map-footer {
display: flex;
align-items: center;
gap: 12px;
padding: 14px 20px;
}
.map-meta {
flex: 1;
}
.map-badge {
display: inline-block;
background: #dcfce7;
color: #166534;
font-size: 12px;
font-weight: 600;
padding: 4px 10px;
border-radius: 20px;
}
.map-directions-btn {
display: inline-block;
background: #111827;
color: #fff;
text-decoration: none;
font-size: 13px;
font-weight: 700;
padding: 9px 18px;
border-radius: 10px;
white-space: nowrap;
transition: opacity 0.15s;
}
.map-directions-btn:hover {
opacity: 0.85;
}// Static map embed — no JavaScript required<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Map Embed Card</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="demo">
<div class="map-card">
<div class="map-header">
<div class="map-icon">📍</div>
<div>
<h2 class="map-title">Acme HQ</h2>
<p class="map-address">350 5th Avenue, New York, NY 10118</p>
</div>
</div>
<div class="map-frame">
<!-- OpenStreetMap embed — no API key needed -->
<iframe
title="Location map"
src="https://www.openstreetmap.org/export/embed.html?bbox=-74.0055%2C40.7479%2C-74.0000%2C40.7510&layer=mapnik&marker=40.7485%2C-74.0027"
allowfullscreen
loading="lazy"
referrerpolicy="no-referrer-when-downgrade">
</iframe>
</div>
<div class="map-footer">
<div class="map-meta">
<span class="map-badge">Open now · 9 AM – 6 PM</span>
</div>
<a href="https://www.openstreetmap.org/?mlat=40.7485&mlon=-74.0027#map=16/40.7485/-74.0027" target="_blank" rel="noopener" class="map-directions-btn">
Get Directions →
</a>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>Map embed card using a free OpenStreetMap iframe (no API key required), styled with rounded corners and a shadow, plus an address header and a “Get directions” CTA button below the map.