Website Tools

HTML Navbar Generator

Create a navigation bar that works on phones, keyboards and screen readers. List your links, set the current page, an optional call-to-action button, theme and breakpoint, and get HTML, CSS and a short script for the mobile menu. Preview it as desktop or phone, closed or open. Without JavaScript the menu simply stays visible, so no visitor is ever locked out.

  • Runs in your browser
  • No sign-up
  • Free to use
Start from an example
px

    How to use HTML Navbar Generator

    1. Enter the brand and the links as Label | URL lines.
    2. Set the current page and an optional call-to-action.
    3. Choose the theme, accent colour and mobile breakpoint.
    4. Copy the HTML, CSS and JavaScript into your site.

    HTML Navbar Generator features

    Landmarks

    <header> and <nav aria-label="Main"> for quick navigation.

    Mobile toggle

    A real button with aria-expanded and aria-controls.

    Progressive enhancement

    The menu collapses only after the script has run.

    Current page

    aria-current="page" with a visible indicator.

    Keyboard

    Escape closes the menu and returns focus to the button.

    Skip link

    “Skip to content” for keyboard users, plus a sticky header option.

    When to use HTML Navbar Generator

    • Starting the header of a new website or landing page.
    • Replacing a CSS-only checkbox hack with an accessible toggle.
    • Documentation sites with a dark header.
    • Small shops with a cart button.

    HTML Navbar Generator FAQ

    Why a button for the hamburger icon?

    A <button> is focusable and works with Enter and Space. aria-expanded tells screen readers whether the menu is open, and aria-controls links it to the list it controls.

    What happens without JavaScript?

    The collapse styles only apply after the script adds the --enhanced class. If the script fails or is blocked, all links are shown and wrap onto several lines.

    What does aria-current do?

    It marks the link of the page you are on, so screen readers say “current page”. The CSS underlines it for sighted users.

    What is the skip link?

    The first focusable element on the page. Keyboard users press Tab once and can jump past the navigation to the main content; it is hidden until focused.

    How many links should a navbar have?

    Usually five to seven. Longer lists are hard to scan on mobile; move secondary pages to the footer.

    Is anything uploaded?

    No. Everything is generated in your browser; the preview runs no scripts.

    Accessible responsive navigation

    The navigation bar is the first thing keyboard and screen reader users meet on every page, so its flaws are repeated on every visit. Typical problems are hamburger icons built from a <div>, menus that cannot be closed with the keyboard, no indication of the current page and menus that disappear completely when JavaScript fails.

    The generator wraps the links in a <nav> with an accessible name inside a <header>, giving assistive technology landmarks to jump to. Links sit in a list so screen readers announce how many there are. The current page gets aria-current="page" and a visible underline in the accent colour.

    On narrow screens a real button toggles the menu. Its state lives in aria-expanded, and the CSS shows the list when that attribute is true, so the visible state and the announced state can never disagree. Escape closes the menu and returns focus, and widening the window past the breakpoint resets it.

    The collapse is progressive enhancement: the CSS only hides the menu inside the --enhanced class that the script adds. With JavaScript disabled, blocked or broken, the full list is shown. The script is a few lines without dependencies and can be loaded with defer.

    A skip link lets keyboard users bypass the navigation, a sticky option keeps the header visible while scrolling, and focus outlines and contrast are checked against the chosen theme. The preview emulates phone and desktop widths, with the menu open or closed, inside a sandboxed frame.

    Other useful tools