The Exact Navbar Code — Copy & Use
This is the navbar pattern used in every UIXDraft template — sticky, responsive, with mobile toggle:
/* ── CSS ────────────────────────────── */
nav {
position: sticky; top: 0; z-index: 99;
display: flex; align-items: center; gap: 24px;
padding: 16px 24px;
background: rgba(6,8,15,.95);
backdrop-filter: blur(8px);
border-bottom: 1px solid rgba(255,255,255,.07);
}
.nav-links { display: flex; gap: 20px; list-style: none; }
.nav-cta { margin-left: auto; background: #7c3aed;
color: #fff; padding: 8px 18px; border-radius: 8px; }
.hamburger { display: none; }
/* Mobile */
@media (max-width: 768px) {
.nav-links { display: none; flex-direction: column;
position: fixed; inset: 60px 0 0 0; background: #06080f;
padding: 24px; }
.nav-links.open { display: flex; }
.hamburger { display: block; margin-left: auto;
background: none; border: none; color: #fff; font-size: 24px; }
}
Frequently Asked Questions
How do I add a sticky navbar to an HTML template?
Use CSS: `nav { position: sticky; top: 0; z-index: 99; background: rgba(0,0,0,.9); backdrop-filter: blur(8px); }`. This sticks the navbar to the top as the user scrolls, with a blurred background so content underneath is readable. No JavaScript required for sticky. Add a mobile hamburger toggle with 5 lines of JavaScript for the mobile menu open/close toggle.
How do I make a responsive navbar in HTML?
3-step approach: 1) Desktop: flex layout with logo left, links center, CTA right. 2) Mobile breakpoint (768px): hide links with `display:none`, show hamburger button. 3) JavaScript: toggle a `.open` class on the nav-links when hamburger is clicked. The CSS shows the links as a full-screen overlay when `.open` is present. UIXDraft templates include this pattern pre-built.
What is the best HTML navbar template?
UIXDraft templates include 4 navbar patterns: sticky with blur, transparent-to-solid on scroll, minimal single-CTA, and sidebar navigation for dashboards. All are mobile-responsive with hamburger menus, keyboard accessible, and score 88–97 PageSpeed. Part of the 180+ template pack at $35 one-time.
How do I create a dropdown menu in HTML?
CSS-only dropdown: wrap items in a `.dropdown` div. Style the submenu with `position:absolute; display:none`. Show on hover with `.dropdown:hover .submenu { display:block }`. For accessibility: add `aria-haspopup='true'` and keyboard focus support with `:focus-within`. JavaScript-free dropdowns work in all modern browsers.
How do I make a navbar with a hamburger menu?
HTML: add a `<button class='hamburger' aria-label='Menu'>☰</button>` in the nav. CSS: hide it on desktop (`display:none`), show at mobile breakpoint. JavaScript: `document.querySelector('.hamburger').addEventListener('click', () => document.querySelector('.nav-links').classList.toggle('open'))`. 5 lines of code — no jQuery needed.