Bootstrap 5 Responsive Header Menu with Top Bar
A responsive header with a utility contact bar, main navigation with a dropdown, a collapsing mobile menu and a photo hero beneath it.
<section class="wdw-stage py-3 py-md-5">
<div class="container hm-wrap px-3 px-md-4">
<div class="wdw-card overflow-hidden">
<div class="hm-top d-flex align-items-center justify-content-between px-3 px-lg-4 py-2 small">
<div class="d-flex flex-wrap column-gap-4 row-gap-1">
<span class="d-none d-lg-inline-flex align-items-center gap-2"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg>Mon–Sat, 9am–6pm</span>
<a class="d-inline-flex align-items-center gap-2 link-body-emphasis link-underline-opacity-0" href="mailto:[email protected]"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg>[email protected]</a>
<a class="d-inline-flex align-items-center gap-2 link-body-emphasis link-underline-opacity-0" href="tel:+18001234567"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2"/></svg>(800) 123-4567</a>
</div>
<span class="wdw-muted d-none d-lg-inline">Free consultation for new projects</span>
</div>
<nav class="navbar navbar-expand-lg bg-body px-3 px-lg-4 border-top border-bottom" aria-label="Main">
<a class="navbar-brand fw-bold d-flex align-items-center gap-2 text-body-emphasis" href="#">
<span class="wdw-icon hm-logo"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 9 5-9 5-9-5 9-5Z"/><path d="m3 13 9 5 9-5"/></svg></span>Northwind
</a>
<button class="navbar-toggler border-0" type="button" data-bs-toggle="collapse" data-bs-target="#hmNav" aria-controls="hmNav" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="hmNav">
<ul class="navbar-nav ms-lg-auto align-items-lg-center gap-lg-1 py-3 py-lg-0">
<li class="nav-item"><a class="nav-link active fw-semibold" aria-current="page" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Listings</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Pages</a>
<ul class="dropdown-menu border-0">
<li><a class="dropdown-item py-2" href="#">About us</a></li>
<li><a class="dropdown-item py-2" href="#">Our team</a></li>
<li><a class="dropdown-item py-2" href="#">Pricing</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item py-2" href="#">FAQ</a></li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="#">Tutorials</a></li>
<li class="nav-item"><a class="nav-link" href="#">Contact</a></li>
<li class="nav-item ms-lg-3 mt-2 mt-lg-0"><a class="btn btn-primary rounded-pill px-4" href="#">Book a visit</a></li>
</ul>
</div>
</nav>
<div class="hm-hero d-flex align-items-end">
<div class="p-4 p-lg-5 text-white hm-copy">
<span class="badge rounded-pill text-bg-light mb-3">New collection</span>
<h1 class="display-5 fw-bold mb-2">Spaces that feel like home</h1>
<p class="lead mb-4 opacity-100">Interior design and styling for modern living.</p>
<div class="d-flex flex-wrap gap-2"><a class="btn btn-light rounded-pill px-4" href="#">View projects</a><a class="btn btn-outline-light rounded-pill px-4" href="#">Book a visit</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 */
.hm-wrap { max-width: 1040px; }
.hm-top { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.hm-logo { width: 2.25rem; height: 2.25rem; border-radius: .7rem; }
#hmNav .nav-link { padding: .6rem .9rem; border-radius: 999px; }
#hmNav .nav-link:hover, #hmNav .nav-link.show { background: var(--bs-tertiary-bg); }
#hmNav .nav-link.active { color: var(--bs-primary); }
.hm-hero { min-height: 400px; background: linear-gradient(0deg, rgba(15,17,40,.78), rgba(15,17,40,.1) 70%), url("https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?auto=format&fit=crop&w=1350&q=80") center / cover; }
.hm-copy { max-width: 36rem; }
@media (max-width: 991.98px) { .hm-hero { min-height: 340px; } #hmNav .nav-link { padding-inline: .5rem; } }
<div class="hm-page">
<div class="hm-topbar">
<div class="container hm-topbar-inner">
<ul class="hm-info" role="list">
<li class="hm-info-item d-none md:d-flex">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg>
<div><strong>Sat–Tue: 11:00am–02:00pm</strong><span>Also open on holidays</span></div>
</li>
<li class="hm-info-item d-none lg:d-flex">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg>
<div><strong>[email protected]</strong><span>Feel free to ask any question</span></div>
</li>
<li class="hm-info-item d-flex">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2"/></svg>
<div><strong>(800) 0123 4567</strong><span>24/7 dedicated support</span></div>
</li>
</ul>
<a class="btn-solid theme-primary btn-sm d-none md:d-inline-flex" href="#">Enquire today</a>
</div>
</div>
<header class="hm-header">
<nav class="navbar" aria-label="Main">
<div class="container hm-nav-inner">
<a class="hm-logo" href="#" aria-label="Tolmatol home">
<svg width="30" height="30" viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="currentColor"/><path d="M9 11h14M16 11v11" stroke="#fff" stroke-width="3" stroke-linecap="round"/></svg>
<span>Tolmatol</span>
</a>
<ul class="nav navbar-nav d-none lg:d-flex hm-links">
<li class="nav-item"><a class="nav-link active" href="#" aria-current="page">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Listing</a></li>
<li class="nav-item">
<button class="nav-link" type="button" data-bs-toggle="menu" aria-expanded="false">
Pages
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m3 6 5 5 5-5"/></svg>
</button>
<div class="menu">
<a class="menu-item" href="#">About us</a>
<a class="menu-item" href="#">Our team</a>
<hr class="menu-divider">
<a class="menu-item" href="#">Pricing</a>
</div>
</li>
<li class="nav-item"><a class="nav-link" href="#">Extra</a></li>
<li class="nav-item"><a class="nav-link" href="#">Tutorial</a></li>
<li class="nav-item"><a class="nav-link" href="#">Contact us</a></li>
</ul>
<button class="btn-icon navbar-toggler lg:d-none" type="button" data-bs-toggle="drawer" data-bs-target="#hmMenu" aria-controls="hmMenu" aria-label="Open navigation">
<span class="navbar-toggler-icon" aria-hidden="true"></span>
</button>
</div>
</nav>
</header>
<dialog class="drawer drawer-end" id="hmMenu" tabindex="-1" aria-labelledby="hmMenuLabel">
<div class="drawer-header">
<h2 class="drawer-title fs-lg" id="hmMenuLabel">Menu</h2>
<button type="button" class="btn-close" data-bs-dismiss="drawer" aria-label="Close"></button>
</div>
<div class="drawer-body">
<ul class="nav navbar-nav hm-drawer-links">
<li class="nav-item"><a class="nav-link active" href="#" aria-current="page">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Listing</a></li>
<li class="nav-item">
<details class="hm-sub">
<summary class="nav-link">Pages <svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m3 6 5 5 5-5"/></svg></summary>
<ul class="hm-sub-list">
<li><a class="nav-link" href="#">About us</a></li>
<li><a class="nav-link" href="#">Our team</a></li>
<li><a class="nav-link" href="#">Pricing</a></li>
</ul>
</details>
</li>
<li class="nav-item"><a class="nav-link" href="#">Extra</a></li>
<li class="nav-item"><a class="nav-link" href="#">Tutorial</a></li>
<li class="nav-item"><a class="nav-link" href="#">Contact us</a></li>
</ul>
<a class="btn-solid theme-primary hm-drawer-cta" href="#">Enquire today</a>
</div>
</dialog>
<section class="hm-hero">
<img src="https://images.unsplash.com/photo-1586023492125-27b2c045efd7?w=1800&q=80" alt="Bright living room with a sofa and wooden furniture" width="1800" height="1100">
<div class="container hm-hero-copy">
<p class="fs-sm hm-eyebrow">Interiors & furniture</p>
<h1 class="fs-4xl">Rooms that feel like home</h1>
<a class="btn-solid theme-primary btn-lg" href="#">Browse listings</a>
</div>
</section>
<section class="hm-features">
<div class="container hm-feature-grid">
<article><h2 class="fs-lg">Free design consult</h2><p class="fg-3">Book a 30-minute visit and walk through your space with a stylist.</p></article>
<article><h2 class="fs-lg">Delivery in 5 days</h2><p class="fg-3">In-stock sofas, tables and lighting arrive assembled at your door.</p></article>
<article><h2 class="fs-lg">30-day returns</h2><p class="fg-3">Try it at home. If it does not fit the room, we collect it for free.</p></article>
</div>
</section>
</div>
.hm-page { display: flex; flex-direction: column; background: var(--bs-bg-body); min-height: 100vh; }
.hm-topbar { border-bottom: 1px solid var(--bs-border-color); background: var(--bs-bg-1); }
.hm-topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .75rem; }
.hm-info { display: flex; gap: 2rem; margin: 0; padding: 0; list-style: none; }
.hm-info-item { align-items: center; gap: .75rem; }
.hm-info-item svg { color: var(--bs-primary-base); flex: none; }
.hm-info-item div { display: flex; flex-direction: column; line-height: 1.3; }
.hm-info-item strong { font-size: .8125rem; font-weight: 600; }
.hm-info-item span { font-size: .75rem; color: var(--bs-fg-3); }
.hm-header { position: sticky; top: 0; z-index: 20; background: var(--bs-bg-body); border-bottom: 1px solid var(--bs-border-color); }
.hm-logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--bs-primary-base); font-weight: 700; font-size: 1.25rem; text-decoration: none; }
.hm-logo span { color: var(--bs-fg-body); letter-spacing: -.01em; }
.hm-hero { flex: none; position: relative; display: flex; align-items: center; min-height: 440px; overflow: hidden; isolation: isolate; }
.hm-hero > img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.hm-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgb(10 10 20 / .72), rgb(10 10 20 / .15)); }
.hm-hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; color: #fff; }
.hm-hero-copy h1 { max-width: 14ch; margin: 0; color: #fff; }
.hm-eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .14em; color: rgb(255 255 255 / .8); }
@media (width < 768px) { .hm-hero { min-height: 360px; } }
.hm-nav-inner { display: flex; align-items: center; justify-content: space-between; padding-block: .5rem; }
.hm-links { align-items: center; flex-direction: row; gap: .25rem; margin: 0; }
.hm-links .nav-item { position: relative; }
.hm-drawer-links { gap: .125rem; }
.hm-sub summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.hm-sub summary::-webkit-details-marker { display: none; }
.hm-sub[open] summary svg { transform: rotate(180deg); }
.hm-sub-list { margin: 0; padding: 0 0 0 1rem; list-style: none; }
.hm-drawer-cta { margin-top: 1.5rem; width: 100%; }
dialog.drawer:not([open]) { block-size: 0; border-width: 0; }
.hm-features { padding-block: 4rem; background: var(--bs-bg-1); }
.hm-feature-grid { display: grid; gap: 2rem; }
.hm-feature-grid h2 { margin-block-end: .5rem; }
.hm-feature-grid p { margin: 0; }
@media (width >= 768px) { .hm-feature-grid { grid-template-columns: repeat(3, 1fr); } }
.hm-sub-list .nav-link { display: flex; justify-content: flex-start; }
// The drawer only exists for the sub-lg layout: close it if the viewport grows past lg.
const initNavDrawer = () => {
const drawer = document.getElementById('hmMenu')
if (!drawer) return
const desktop = window.matchMedia('(width >= 1024px)')
desktop.addEventListener('change', () => {
if (desktop.matches && drawer.open) drawer.close()
})
}
initNavDrawer()
Built on Bootstrap 6.0.0-alpha.1 (ES modules, no jQuery). Load Bootstrap through an import map and run the JavaScript as type="module" — the downloaded file is already set up that way. Alpha releases can still change class names.
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.