Web Navigation HTML / CSS / JS Browser E2E & Sandbox Verified

Responsive Navigation Bar

Sticky top navigation header with keyboard-accessible mobile menu drawer, Escape-to-close behavior, and clean semantic landmarks.

ID: web/responsive-navbar Version: 1.0.0 License: MIT Framework: Vanilla Web

Sandboxed Live Preview

Isolated iframe (CSP + no same-origin)

Interactive live preview — click the mobile menu toggle or tab through links.

Source Code (3 files)

navbar.html · html
<header class="otter-nav">
  <div class="otter-nav-inner">
    <a class="otter-nav-brand" href="#top">Otter Hub</a>
    <button type="button" class="otter-nav-toggle" aria-expanded="false" aria-controls="otterNavMenu">
      Menu
    </button>
    <nav id="otterNavMenu" class="otter-nav-links" aria-label="Primary">
      <a href="#library" aria-current="page">Library</a>
      <a href="#packs">Packs</a>
      <a href="#workflows">Workflows</a>
      <a href="#docs">Docs</a>
    </nav>
  </div>
</header>
<main class="otter-nav-demo-body">
  <p>Resize the viewport or click <strong>Menu</strong> to test the responsive drawer.</p>
</main>

Installation & Usage

Copy navbar.html, navbar.css, and navbar.js into your project and include the script with defer.

Place <header class="otter-nav"> at the top of <body>. Toggle aria-current="page" on the active navigation link.