The navigation menu is the most-touched component on any website — every visitor interacts with it within the first 3 seconds of arrival. These 15 hand-coded navigation patterns cover every production use case: horizontal nav with hover underline, dropdown menu, mega menu, hamburger slide-out drawer, full-screen overlay, sticky header with scroll shrink, sidebar navigation, tab nav with animated indicator, breadcrumb trail, glassmorphism nav, animated icon nav with labels, multi-level accordion, magnetic hover, neon glow, and morphing pill indicator. 13 are 100% pure CSS using :hover / :focus-within / :checked state machines (drop into any stack with zero JS); 2 use ~20-50 lines of vanilla JavaScript for sticky-scroll behaviour and pointer-tracking magnetic hover. All respect prefers-reduced-motion, use scoped .nav-NN__* class names so multiple navs coexist without style bleed, ship semantic <nav> + aria-current="page" markup, MIT-licensed.

13 pure CSS2 light JSPublished

Related20 CSS Responsive Navbar Designs25 CSS Sticky Navigation22 CSS Dropdown Menu Designs16 CSS Mobile Navigation Patterns

CSS Horizontal Navigation Bar with Hover Underline — preview
01 / 15Pure CSS

CSS Horizontal Navigation Bar with Hover Underline

A clean, professional horizontal navigation bar featuring smooth animated underline indicators on hover. Built with CSS custom properties for easy theming, this pattern is the foundation of most website headers — links slide a colored underline in from the left on hover with a cubic-bezier transition.

Published

CSS Dropdown Navigation Menu — preview
02 / 15Pure CSS

CSS Dropdown Navigation Menu

A multi-level dropdown navigation built entirely with CSS using the checkbox hack and :focus-within for accessibility. Submenus fade and slide down on hover, with smooth opacity and transform transitions — no JavaScript required.

Published

CSS Mega Menu Navigation — preview
03 / 15Pure CSS

CSS Mega Menu Navigation

A full-width mega menu with categorized link columns, featured cards, and icon-enhanced entries. The mega panel spans the full viewport width and organizes content into a responsive grid, perfect for content-heavy sites like e-commerce or documentation portals.

Published

CSS Hamburger Menu with Slide-Out Drawer — preview
04 / 15Pure CSS

CSS Hamburger Menu with Slide-Out Drawer

A mobile-first hamburger menu that reveals a full-height slide-out navigation drawer using only a hidden checkbox. The three-bar icon morphs into an X when active, and a backdrop overlay fades in behind the open drawer.

Published

CSS Full-Screen Overlay Navigation — preview
05 / 15Pure CSS

CSS Full-Screen Overlay Navigation

A dramatic full-screen navigation overlay that covers the entire viewport with a dark semi-transparent background. Menu links animate in with a staggered slide-up entrance, creating a cinematic reveal effect perfect for portfolio and creative agency sites.

Published

CSS Sticky Navigation Bar with Scroll Shrink — preview
06 / 15CSS + JS

CSS Sticky Navigation Bar with Scroll Shrink

A sticky navigation bar that smoothly shrinks its height and adds a drop shadow as the user scrolls down, with a scroll-progress indicator bar at the top. The shrink effect is driven by a CSS class toggled via a tiny IntersectionObserver-based scroll listener.

Published

CSS Sidebar Navigation Menu — preview
07 / 15Pure CSS

CSS Sidebar Navigation Menu

A collapsible vertical sidebar navigation with nested sub-menus, icon support, and a mini-mode that collapses to icon-only width. The sidebar uses CSS Grid for layout and supports multiple levels of navigation hierarchy, ideal for admin dashboards and web apps.

Published

CSS Tab Navigation with Animated Indicator — preview
08 / 15Pure CSS

CSS Tab Navigation with Animated Indicator

A tab navigation component with a smooth sliding pill indicator that moves between tabs using only CSS. The indicator position and width are driven by CSS custom properties set via sibling selectors from hidden radio inputs — no JavaScript required for the animation.

Published

CSS Breadcrumb Navigation — preview
09 / 15Pure CSS

CSS Breadcrumb Navigation

A versatile breadcrumb navigation component with three style variants: classic arrow separators, rounded pill badges, and a slash-separated minimal style. Breadcrumbs improve site navigation hierarchy clarity and are critical for SEO structured data markup.

Published

CSS Navigation with Glassmorphism Effect — preview
10 / 15Pure CSS

CSS Navigation with Glassmorphism Effect

A stunning glassmorphism navigation bar with frosted glass effect, floating gradient orbs in the background, and animated blob shapes. The glass panel uses backdrop-filter: blur() for the frosted effect, with subtle border and inner glow for depth.

Published

CSS Animated Navigation Icons with Labels — preview
11 / 15Pure CSS

CSS Animated Navigation Icons with Labels

A bottom navigation bar with animated SVG icons and floating labels, designed for mobile app interfaces. Each icon features a unique CSS keyframe animation on the active state — bounce, spin, wiggle, pulse, and morph — creating an expressive, app-like feel.

Published

CSS Multi-Level Accordion Navigation — preview
12 / 15Pure CSS

CSS Multi-Level Accordion Navigation

A hierarchical accordion sidebar navigation with smooth expand/collapse animations, nested sub-menus, and visual depth indicators. Built with CSS max-height transitions and hidden checkbox inputs — ideal for documentation sites and complex application navigation trees.

Published

CSS Navigation with Magnetic Hover Effect — preview
13 / 15CSS + JS

CSS Navigation with Magnetic Hover Effect

An interactive navigation bar where menu items subtly attract to the cursor using a magnetic effect. CSS custom properties --dx and --dy are updated on mouse move via JavaScript, and CSS translate applies the offset — creating a fluid, physics-inspired hover interaction.

Published

CSS Neon Glow Navigation Menu — preview
14 / 15Pure CSS

CSS Neon Glow Navigation Menu

A cyberpunk-inspired navigation menu with neon glow effects, flickering animations, and a dark grid background. Active and hovered links pulse with multi-layer box-shadow and text-shadow glows in electric cyan and magenta, creating a retro-futuristic aesthetic.

Published

CSS Morphing Navigation Pill Indicator — preview
15 / 15Pure CSS

CSS Morphing Navigation Pill Indicator

An advanced navigation component featuring a morphing pill indicator that smoothly slides and stretches between tab positions using only CSS. The pill uses a squash-and-stretch scale animation during transition, creating a fluid, organic movement that feels alive.

Published

FAQ

Frequently asked questions

What's the difference between a navbar, navigation menu, and a navigation bar?
Three terms developers and designers use interchangeably with subtle distinctions. Navigation menu is the most generic — the list of links that lets visitors move between pages or sections, regardless of layout (horizontal, vertical, dropdown, drawer, mega). Navigation bar (navbar) specifically refers to a horizontal nav at the top of the page — the Bootstrap-popularized term. Every navbar is a navigation menu; not every navigation menu is a navbar (a sidebar drawer isn't a navbar). Header navigation is the broader term for the top-of-page navigation including logo, primary nav links, search, CTA buttons, account icons. Footer navigation is the secondary nav at the bottom — links to legal, contact, about, sitemap. This collection's 15 demos cover all these: horizontal navbar (Demos 01, 06, 10), dropdown menus inside a navbar (Demo 02), mega menus (Demo 03), drawer navigations (Demo 04, 07), full-screen overlays (Demo 05), tab nav (Demo 08), breadcrumb trails (Demo 09), icon nav (Demo 11), multi-level accordion (Demo 12), magnetic-hover nav (Demo 13), neon nav (Demo 14), pill-indicator nav (Demo 15). Pick the term that matches your stakeholder's vocabulary; the techniques apply identically.
Should I use Tailwind UI / Headless UI / Radix Navigation, Material UI AppBar, or build with vanilla CSS?
Depends on your stack and the complexity of the navigation you're building. If you're building a simple horizontal nav (logo, 4-6 links, maybe a CTA button) — vanilla CSS wins. ~20 lines of CSS, zero dependencies, ships in any framework. The 13 pure-CSS demos in this collection cover 90% of real-world nav needs without ANY JavaScript. If you're on React + need complex nav with menus + submenus + keyboard navigation + ARIA — Headless UI's <Menu> (~3kb) or Radix Navigation Menu (~8kb) ship the accessibility primitives so you don't have to handle focus management yourself. Worth the bundle if you're shipping multi-level menus across many pages. If you're on Tailwind UI ($300+ paid) — beautiful designs but requires a React/Vue framework. If you're on Material UI — MUI's <AppBar> + <Menu> is excellent IF you're already paying the ~95kb MUI bundle cost. Cost comparison: This collection — 0 bytes of JavaScript, ~1-3kb of CSS per demo. Headless UI Menu — 3kb React-only. Radix Navigation — 8kb React-only. MUI AppBar+Menu — 95kb React-only. Tailwind UI — $300+ design system + React/Vue. ChakraUI Menu — 5kb React-only. Ant Design Menu — 15kb React-only. This collection's pure-CSS approach: framework-neutral (Astro, Vue, Svelte, Rails ERB, vanilla, WordPress), MIT-licensed, modify-and-resell allowed.
How do I build a responsive hamburger menu that turns into a horizontal navbar on desktop?
Demo 04 (Hamburger Menu with Slide-Out Drawer) + Demo 01 (Horizontal Nav with Hover Underline) combined cover the canonical responsive nav pattern. The pattern: (1) Default layout: horizontal navbar. Logo on left, 4-6 nav links centered or right-aligned, CTA button on far right. Built with display: flex; align-items: center; justify-content: space-between; on the <nav> element. (2) Below 768px: hamburger drawer. Hide the horizontal links via @media (max-width: 768px) { .nav-links { display: none } }. Show the hamburger icon (3 stacked bars) instead. Tap toggles a checkbox via the <label for="toggle"> trick, and :checked sliding the drawer in from the side via transform: translateX(0). (3) Drawer content. Same nav links as desktop, but stacked vertically with larger touch targets (48px+ height each), bigger fonts (16-18px). Add a backdrop overlay (semi-transparent black behind the drawer) for the tap-outside-to-close interaction. (4) Logo behaviour stays in place; the hamburger replaces the desktop nav links. (5) State persistence: pure-CSS version uses the :checked state on a hidden checkbox. JS-version persists via localStorage so close-and-reopen doesn't lose state. Three production-grade details most online tutorials skip: (a) Lock body scroll when drawer is open via html:has(#nav-toggle:checked) body { overflow: hidden } (requires :has() — Chrome 105+, Safari 15.4+, Firefox 121+). (b) Focus trap when drawer is open (pure CSS can't do this — for accessibility-critical UIs, add ~10 lines of JS). (c) ESC-to-close: pure CSS can't catch keyboard. JS-enhanced version adds keydown listener.
How do I build a mega menu like Amazon / Shopify / Adobe?
Demo 03 (CSS Mega Menu Navigation) ships the canonical e-commerce/SaaS mega menu pattern. The pattern: (1) Top-level navbar with 4-6 category labels. (2) On hover or click, a full-width dropdown panel appears below the navbar, spanning the entire viewport width. The mega menu typically contains 3-5 columns of links organized by sub-category, plus a feature panel on the right (featured product, promo banner, or visual). (3) Multi-column grid: display: grid; grid-template-columns: repeat(3, 1fr) 1.5fr; gap: 32px; — three equal columns of links plus a wider feature panel on the right. (4) Animation: the mega menu fades in via opacity: 0 → 1 + transform: translateY(-8px) → translateY(0) over 200ms when the hover bridge is triggered. Five production-grade details most online mega menu tutorials skip: (a) Hover delay — use a 200ms transition-delay on the opacity to prevent the menu from appearing on accidental cursor passes over the trigger. (b) Hover bridge — invisible padding between the trigger and the menu so the cursor can move from one to the other without the hover state breaking. (c) Keyboard accessibility: use :focus-within in addition to :hover so keyboard users can tab through the menu. (d) Mobile fallback: hide the mega menu entirely below 768px and replace with the accordion pattern (Demo 12). Mega menus don't fit on mobile screens. (e) z-index management: the mega menu must stack ABOVE page content but BELOW any open modal. Use a CSS custom property like --z-mega-menu: 50 so all stacking constants live in one place.
How do I make a sticky navbar that shrinks on scroll?
Demo 06 (Sticky Navigation Bar with Scroll Shrink) ships this. The pattern uses ~30 lines of vanilla JavaScript to add an .is-shrunk class to the <nav> once scroll position exceeds 50-100px from the top. The CSS handles the transition: .nav { height: 80px; padding: 24px 32px; transition: all 0.3s ease; } .nav.is-shrunk { height: 56px; padding: 12px 32px; backdrop-filter: blur(12px); background: rgba(255,255,255,0.8); }. The logo, links, and CTA inside the nav shrink proportionally via inheritance + scale transform. Three modern alternatives to JavaScript scroll listeners: (1) CSS scroll-driven animations (Chrome 115+, Safari 18+, Firefox 138+): animation-timeline: scroll(); drives the shrink animation entirely in CSS. Falls back to no-op on older browsers — graceful. (2) position: sticky + scroll snap: lighter-weight, works in every modern browser, no JS at all. The nav sits at top: 0 and stays there as the user scrolls past it. Doesn't shrink, just sticks. (3) IntersectionObserver: place a sentinel element at the top of the page; observe when it scrolls out of view; add the .is-shrunk class. More performant than scroll listeners because the browser handles the observation. Cost: ~10 lines of JS. Demo 06's JS approach: works in every browser, fully controlled, ~30 lines of code. Pick scroll-driven CSS if you can require Chrome 115+; pick IntersectionObserver for the best modern compromise; pick the demo's setTimeout-throttled scroll listener if you need IE11-era compatibility (rare today).
How do I build an accessible navigation menu (keyboard + screen readers + WCAG)?
Six accessibility considerations matter for navigation, and all 15 demos in this collection address them. (1) Semantic HTML. Use <nav aria-label="Main"> wrapping a <ul> + <li> + <a> structure. Screen readers (NVDA, JAWS, VoiceOver, TalkBack) announce the nav landmark and let users skip to it directly via the landmarks shortcut. (2) aria-current="page" on the active link. Screen readers announce "current page" alongside the visible highlight. Without this, blind users have no idea which page they're on. (3) aria-expanded on dropdown / hamburger / mega-menu toggle buttons. Toggles between true/false when the menu opens/closes. (4) aria-haspopup on dropdown triggers. Tells assistive tech that activating the button reveals a popup menu (not just navigates to a page). (5) Keyboard navigation. Tab moves between top-level links, Space/Enter activates, Escape closes dropdowns, Arrow keys move within a submenu. Real <button> + <a> elements (not divs styled as buttons) give this for free. (6) Skip-to-content link: <a href="#main" class="skip-link">Skip to content</a> visually hidden by default but visible on focus. Keyboard users tab once and can skip the entire nav. WCAG 2.4.1 requirement. (7) prefers-reduced-motion: reduce — for vestibular-sensitive users, disable slide-in / shrink / parallax animations. All 15 demos here ship this. (8) Tap-target size: WCAG 2.5.5 (AAA) requires 44×44px minimum. Every link in this collection meets it. Common mistakes most online tutorials make: using <div> with onClick instead of <button> (breaks keyboard), animating the visible-icon-state without setting aria-label (e.g. "Open menu" → "Close menu"), forgetting aria-current entirely. All 15 demos here ship the markup correctly out of the box.
Sticky navbar vs fixed navbar vs absolute — what's the difference?
Three CSS positioning values, three different scroll behaviours. position: sticky — the nav scrolls WITH the page normally UNTIL it hits a specific offset (typically top: 0), then it sticks. As soon as you scroll back up past the original position, it stops being sticky and scrolls with the page again. Behavior: stays at the top once you've scrolled past it; releases when you scroll back up. Best for: navigation that's part of a long-scrolling page and should stay accessible without dominating the viewport on initial load. position: fixed — the nav is ALWAYS positioned relative to the viewport. It doesn't scroll with the page at all. From the moment the page loads, it sits at top: 0 and stays there regardless of scroll position. Behavior: always visible. Best for: apps where the nav is the primary UI element (SaaS dashboards, document editors, web apps). position: absolute — the nav is positioned relative to its nearest positioned ancestor (NOT the viewport). It scrolls with the page like normal block elements but its position is calculated from the ancestor's edge, not the document flow. Rarely used for primary navigation. For sticky: the parent of the sticky element matters — sticky positioning is relative to the nearest scrolling ancestor. Browser support: position: sticky universal since Edge 16 (2017). Demo 06 (Sticky Navigation Bar with Scroll Shrink) uses sticky + a JS class toggle to add the shrink effect — same as the GitHub/Vercel/Linear navbar pattern.
Will navigation menu hover animations hurt my Core Web Vitals INP score?
Not if you follow the same rule as all CSS animations: animate transform and opacity only. Every demo in this collection follows this — sliding underline uses transform: scaleX(0) → scaleX(1), not width: 0% → 100%; dropdown reveal uses opacity: 0 → 1 + transform: translateY(-8px) → 0, not display: none → block with positioning recalculation; sliding tab indicator uses transform: translateX(), not left. All these are GPU-accelerated on the compositor thread — they DON'T trigger layout recalculation, so they DON'T affect INP (Interaction to Next Paint), the Core Web Vital that replaced FID in March 2024. Three nav-specific gotchas: (a) Animating backdrop-filter on glassmorphism nav (Demo 10) is expensive — re-evaluates the blur on every frame. Apply the blur to a static state and only animate opacity on a sibling overlay layer. (b) Sticky scroll-driven shrink with JavaScript scroll listener (Demo 06) can saturate the main thread if your handler isn't throttled. Use requestAnimationFrame or replace with IntersectionObserver (the modern pattern). (c) Magnetic hover effect (Demo 13) updates element position on every mousemove — this fires ~60-120 times per second on a fast pointer. Use requestAnimationFrame to coalesce updates; without it, you'll see frame drops on low-end Android. Demo 13's JS uses RAF throttling. Lighthouse mobile-profile: 95+ Performance on all 15 demos on Pixel 5 baseline.
Which navigation menu should I use for my project?
Quick decision guide for all 15 demos. Marketing site / blog with 4-6 destinations: Demo 01 (Horizontal Nav with Hover Underline) — clean, minimal, the universal default. Add Demo 04 (Hamburger Drawer) below 768px for the responsive variant. SaaS app with multi-category navigation: Demo 02 (Dropdown Navigation Menu) — top-level categories that expand on hover/focus to reveal sub-items. E-commerce with deep category hierarchy: Demo 03 (Mega Menu Navigation) — the Amazon / Shopify / Walmart / Adobe pattern, with multi-column dropdown panels organized by sub-category. Content-heavy site (news, magazine, documentation): Demo 04 (Hamburger Drawer) for the off-canvas pattern that surfaces a long list of destinations without dominating the viewport. Editorial / portfolio / design-forward brand: Demo 05 (Full-Screen Overlay) — when activated, the nav takes over the entire viewport with large typography and minimal chrome. SaaS dashboard or web app with persistent header: Demo 06 (Sticky Nav with Scroll Shrink) — the GitHub / Vercel / Linear pattern. SaaS dashboard with primary side nav: Demo 07 (Sidebar Navigation Menu) — Slack / Notion / Linear pattern, full-height left rail. Tab-style content panels (settings, analytics views, profile sections): Demo 08 (Tab Navigation with Animated Indicator) — sliding underline indicator matches Material Design's tab pattern. Deep hierarchy navigation (file browser, settings, multi-step admin): Demo 09 (Breadcrumb Navigation) — schema.org BreadcrumbList markup for SEO bonus. Premium / design-forward / modern aesthetic: Demo 10 (Glassmorphism Navigation) — frosted-glass backdrop-filter for the iOS/macOS/Windows 11 modern look. Icon-driven navigation (mobile apps, dashboards, sidebars): Demo 11 (Animated Navigation Icons with Labels) — icons that animate on hover with labels that slide in. FAQ / settings / docs with nested categories: Demo 12 (Multi-Level Accordion Navigation) — collapsible groups, ideal for sidebars on documentation sites. Premium brand with interactive flair: Demo 13 (Magnetic Hover Effect) — cursor-tracking pull effect on each nav link. Gaming / Web3 / cyberpunk brand: Demo 14 (Neon Glow Menu) — saturated colors with text-shadow glow. Modern minimalist with subtle animation: Demo 15 (Morphing Pill Indicator) — the active link sits inside a pill that morphs to slide to the new active link on click. All 15 demos: 100% pure CSS or pure CSS + minimal JS, semantic <nav> + aria-current + aria-expanded + aria-haspopup, prefers-reduced-motion respected, 44×44px tap targets, MIT-licensed.

Related collections

32 CSS Accordions — Vertical & Horizontal preview

32 CSS Accordions — Vertical & Horizontal

32 free CSS accordions covering pure-CSS FAQ blocks with details/summary, mobile navigation menus, e-commerce filter sidebars, nested tree views, exclusive single-open groups and smoothly animated height:auto — plus 26 visual variations in vertical, horizontal and hybrid layouts. Copy-paste HTML and CSS, no JavaScript.

39 CSS Breadcrumbs preview

39 CSS Breadcrumbs

39 hand-coded CSS breadcrumbs — Schema.org BreadcrumbList Microdata + WCAG 2.2 accessible (Google Rich Results eligible), :has() responsive collapse, dark/light theme toggle with color-mix, Shopify/Amazon e-commerce filter chip removal, Vercel/Linear/Notion SaaS dashboard app-shell pattern, Docusaurus/Mintlify sticky scroll-shrink header, Amazon-style dropdown sibling menus, NFT/Web3 holographic shimmer (@property + conic-gradient), SaaS marketing gradient text, Airbnb filter chip with container queries, editorial blog wave underline, developer docs one-click path copy (Clipboard API), and 26 more. Semantic HTML: <nav aria-label='Breadcrumb'> + <ol> + aria-current='page'. Framework-agnostic, MIT-licensed.

26 CSS Circular Menus preview

26 CSS Circular Menus

26 hand-coded CSS circular and radial menu designs, from the floating-action FAB speed dial and dashboard radial hubs to game-style pie-slice wheels, SVG gooey metaball fans, hexagonal honeycombs, iris-aperture reveals, orbiting satellites on offset-path, compass-rose directional nav, sci-fi HUD rings, glassmorphism popovers built on the native Popover API, vinyl-record players, and full-takeover nebula overlays on native dialog. Every design uses CSS trigonometry (sin(), cos()) or the counter-rotation trick for positioning, ships real keyboard navigation, aria-labels on icon-only buttons, and a prefers-reduced-motion guard. Copy-paste HTML, CSS and vanilla JS with zero framework dependencies — MIT licensed.

Search CodeFronts

Loading…