Bootstrap 5 Contact Form with Map
A split contact section with a floating-label message form and phone link beside a stylised map panel with a location pin and address card.
<section class="wdw-stage">
<div class="container" style="max-width:1040px">
<div class="wdw-card overflow-hidden">
<div class="row g-0">
<div class="col-lg-6 p-4 p-md-5">
<span class="wdw-eyebrow">Contact</span>
<h1 class="wdw-heading display-6 mb-2">Let's talk</h1>
<p class="text-body-secondary mb-4">Tell us about your project and we'll reply within one business day.</p>
<form id="contactForm" novalidate>
<div class="form-floating mb-3"><input type="text" class="form-control" id="cName" placeholder="Name" required autocomplete="name"><label for="cName">Name</label></div>
<div class="form-floating mb-3"><input type="email" class="form-control" id="cEmail" placeholder="Email" required autocomplete="email"><label for="cEmail">Email address</label></div>
<div class="form-floating mb-4"><textarea class="form-control cmsg" id="cMsg" placeholder="Message" required></textarea><label for="cMsg">Message</label></div>
<div class="d-flex flex-wrap align-items-center justify-content-between gap-3">
<button type="submit" class="btn btn-primary rounded-pill px-4">Send message</button>
<a href="tel:+12515469442" class="link-body-emphasis link-underline-opacity-0 fw-semibold d-inline-flex align-items-center gap-2"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8.1 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z"/></svg>251 546 9442</a>
</div>
<div class="alert alert-success d-none mt-3 mb-0" id="contactOk" role="status">Thanks! Your message is on its way.</div>
</form>
</div>
<div class="col-lg-6 map-pane position-relative" style="min-height:340px">
<svg class="map-svg" viewBox="0 0 520 480" preserveAspectRatio="xMidYMid slice" role="img" aria-label="Map showing our San Francisco office">
<rect width="520" height="480" class="m-land"/>
<path class="m-water" d="M0 0h190c-30 70 20 120-10 190S130 340 170 480H0z"/>
<path class="m-park" d="M300 70h110v70H300z"/><path class="m-park" d="M70 330h90v70H70z"/>
<g class="m-road"><path d="M190 0c40 140 120 220 330 250"/><path d="M0 250h520" /><path d="M330 0v480"/><path d="M230 480c20-120 120-170 290-190"/><path d="M420 0v480"/><path d="M250 120h270"/></g>
<g class="m-road2"><path d="M0 160h330"/><path d="M0 340h520"/><path d="M270 0v480"/><path d="M370 0v480"/><path d="M470 0v480"/><path d="M250 420h270"/></g>
</svg>
<div class="map-pin" aria-hidden="true"><span class="pulse"></span><svg width="40" height="48" viewBox="0 0 24 29" fill="var(--bs-primary)"><path d="M12 0C5.4 0 0 5.2 0 11.7 0 20 12 29 12 29s12-9 12-17.3C24 5.2 18.6 0 12 0z"/><circle cx="12" cy="11.5" r="4.5" fill="#fff"/></svg></div>
<div class="wdw-card-sm map-card p-3 d-flex gap-3 align-items-center">
<span class="wdw-icon"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 0 1 16 0z"/><circle cx="12" cy="10" r="3"/></svg></span>
<div class="flex-grow-1"><div class="fw-bold">San Francisco HQ</div><div class="small text-body-secondary">120 Market Street, CA 94105</div></div>
<a class="btn btn-sm btn-outline-primary rounded-pill" href="#">Directions</a>
</div>
</div>
</div>
</div>
</div>
</section>
/* Web Designer Wall library style — shared base for every Bootstrap 5 snippet.
Indigo accent, Plus Jakarta Sans, soft cards, pill buttons. Works in light and dark. */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");
:root,
[data-bs-theme="light"] {
--wdw-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--bs-body-font-family: var(--wdw-font);
--bs-primary: #4f46e5;
--bs-primary-rgb: 79, 70, 229;
--bs-primary-text-emphasis: #3730a3;
--bs-primary-bg-subtle: #eef2ff;
--bs-primary-border-subtle: #c7d2fe;
--bs-link-color: #4f46e5;
--bs-link-color-rgb: 79, 70, 229;
--bs-link-hover-color: #4338ca;
--bs-link-hover-color-rgb: 67, 56, 202;
--bs-focus-ring-color: rgba(79, 70, 229, 0.25);
--bs-border-radius: 0.75rem;
--bs-border-radius-lg: 1rem;
--bs-border-radius-xl: 1.25rem;
--wdw-radius-card: 1.25rem;
--wdw-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 16px 40px -16px rgba(16, 24, 40, 0.22);
--wdw-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px -4px rgba(16, 24, 40, 0.12);
--wdw-stage: #f5f6fb;
}
[data-bs-theme="dark"] {
--bs-primary: #818cf8;
--bs-primary-rgb: 129, 140, 248;
--bs-primary-text-emphasis: #c7d2fe;
--bs-primary-bg-subtle: rgba(129, 140, 248, 0.14);
--bs-primary-border-subtle: rgba(129, 140, 248, 0.35);
--bs-link-color: #a5b4fc;
--bs-link-color-rgb: 165, 180, 252;
--bs-link-hover-color: #c7d2fe;
--bs-link-hover-color-rgb: 199, 210, 254;
--bs-focus-ring-color: rgba(129, 140, 248, 0.35);
--wdw-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
--wdw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
--wdw-stage: #0f1117;
}
body { font-family: var(--wdw-font); -webkit-font-smoothing: antialiased; }
/* Bootstrap compiles its blue into these components; point them at the accent. */
.btn-primary {
--bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
--bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
--bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1117; --bs-btn-hover-bg: #a5b4fc; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-hover-color: #0f1117; --bs-btn-active-color: #0f1117; }
.btn-outline-primary {
--bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
--bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; border-radius: .75rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .6); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.nav { --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-emphasis-color); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-body-color); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); border-radius: .875rem; box-shadow: var(--wdw-shadow-sm); }
.accordion { --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis); --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.badge { font-weight: 600; }
/* Library building blocks — use these instead of re-inventing them per snippet. */
.wdw-stage { min-height: 100vh; display: flex; align-items: center; background: var(--wdw-stage); padding-block: 3rem; }
.wdw-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: var(--wdw-radius-card); box-shadow: var(--wdw-shadow); }
.wdw-card-sm { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 1rem; box-shadow: var(--wdw-shadow-sm); }
.wdw-aurora { position: relative; color: #fff; background: radial-gradient(60% 55% at 100% 0, #818cf8 0, transparent 70%), radial-gradient(65% 60% at 0 100%, #ec4899 0, transparent 65%), #1e1b4b; }
.wdw-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-primary); }
.wdw-heading { font-weight: 800; letter-spacing: -.02em; color: var(--bs-emphasis-color); }
.wdw-muted { color: var(--bs-secondary-color); }
.wdw-icon { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
/* Component */
textarea.cmsg { height: 130px !important; min-height: 130px; }
.map-pane { background: #e8ecf5; overflow: hidden; min-height: 340px; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.m-land { fill: #eceff7; } .m-water { fill: #bcd3f5; } .m-park { fill: #cfe8d5; }
.m-road, .m-road2 { fill: none; stroke: #fff; stroke-linecap: round; } .m-road { stroke-width: 12; } .m-road2 { stroke-width: 5; }
[data-bs-theme="dark"] .map-pane { background: #151823; }
[data-bs-theme="dark"] .m-land { fill: #1a1e2b; } [data-bs-theme="dark"] .m-water { fill: #1b2b4d; } [data-bs-theme="dark"] .m-park { fill: #1d3329; }
[data-bs-theme="dark"] .m-road, [data-bs-theme="dark"] .m-road2 { stroke: #2b3144; }
.map-pin { position: absolute; left: 58%; top: 40%; transform: translate(-50%, -100%); filter: drop-shadow(0 6px 8px rgba(0,0,0,.3)); }
.pulse { position: absolute; left: 50%; bottom: -4px; width: 22px; height: 8px; margin-left: -11px; border-radius: 50%; background: rgba(var(--bs-primary-rgb), .4); animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.6); opacity: 0; } }
.map-card { position: absolute; left: 1rem; right: 1rem; bottom: 1rem; }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
function initContactForm() {
var form = document.getElementById('contactForm');
if (!form) return;
form.addEventListener('submit', function (e) {
e.preventDefault();
form.classList.add('was-validated');
document.getElementById('contactOk').classList.toggle('d-none', !form.checkValidity());
});
}
initContactForm();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.