Responsive Navbar Generator
Build a top navigation bar visually, test it at phone and desktop widths with the keyboard, and copy clean code with no framework.
브라우저에서 실행됩니다. 파일은 기기 밖으로 나가지 않습니다. 확인하는 방법 보기
…
사용 방법
- 1Set the brand
Type the brand name or a logo address, and the text and link of the call-to-action button.
- 2Edit the menu
Add, rename, reorder and delete items, mark the current page and add dropdown links.
- 3Choose the layout
Pick link position, mobile menu type, breakpoint, height, width and sticky behaviour.
- 4Pick colours
Start from a theme, fine-tune the colours and watch the contrast figures.
- 5Test it
Use the full, tablet and phone previews, open the menu and move through it with the keyboard.
- 6Export
Copy the HTML, CSS and script, or download one HTML file and save the settings.
이 도구 소개
A site header looks like a small job until you build it properly: links that collapse into a menu button on phones, dropdowns that open by mouse, touch and keyboard, a menu that closes when you press Escape or tap elsewhere, a visible current page, focus rings, and a layout that does not jump between sizes. This generator gives you all of that as plain HTML, CSS and about fifteen lines of JavaScript, with no framework or icon font. Edit the menu as a list: rename items, change links, move them up and down, delete them, mark the current page, and give any item its own dropdown of links that you can reorder too. Set the brand as text or a logo image and add a call-to-action button. Choose where the links sit (right of the brand, next to it, or centred), the bar height, maximum content width, corner radius, sticky positioning, shadow and bottom border. Colours for the bar, text, hover state and button come with four starting themes and a live contrast check against WCAG AA. Below a breakpoint you choose, the links fold into a menu button with an animated three-line icon, and the menu either opens as a panel under the bar or slides in as a drawer from the right. The script follows the WAI-ARIA disclosure navigation pattern: buttons carry aria-expanded and aria-controls, the menu button's label switches between Open and Close, Escape closes the innermost open menu and returns focus, outside clicks close everything, and widening the window resets the mobile menu. The live preview runs the real code at full, tablet and phone widths.
Why dropdown parents are buttons
When an item has a dropdown, its top-level entry becomes a button that opens the list instead of a link. That is what the accessible disclosure pattern recommends: a single control cannot both navigate and open a menu on touch screens, where there is no hover. Put the parent page inside the dropdown as its first link if it needs to be reachable.
Hover and click
On desktop the dropdowns can also open on hover and on keyboard focus within the item. Click and Enter always work, so touch laptops and keyboard users are covered even with hover turned off.
Using it in a real site
Paste the HTML at the top of the body, add the CSS to your stylesheet and place the script before the closing body tag. Change the class prefix if the default nb clashes with existing styles. Settings can be saved as a JSON file and loaded later, and undo and redo cover every edit.
Limits
The generator makes one navigation bar per prefix and does not build mega menus with columns, search boxes or nested dropdowns more than one level deep. It cannot know which page a visitor is on: in a real site, set aria-current on the matching link in your template.
풀이 예시
Starting from the default menu of five items with two dropdowns (Products with 3 links and Resources with 2), the Dark theme and a 860 pixel breakpoint, the HTML is 27 lines and the CSS about 35 rules. Link contrast is 16.12:1 and the button 16.12:1, both passing AA. At 375 pixels the bar shows only the brand and a 44 by 44 pixel menu button; opening it lists the five items, and Products expands in place to show its three links.
한눈에 보기
- 카테고리: 개발 및 데이터
- 브라우저에서 실행되며 가입도 업로드도 필요 없습니다.
- 입력한 정보는 기기에 머뭅니다.
- 영어로 제공됩니다.
- 콘텐츠 최종 검토일:
- 공식 출처: W3C WAI-ARIA Authoring Practices, Disclosure navigation menu
자주 묻는 질문
Does the navbar need Bootstrap, Tailwind or jQuery?
No. The code is self-contained HTML and CSS with a short vanilla JavaScript block. It works in any site or framework, and you can translate the classes to your own system if you prefer.
Is it accessible for keyboard and screen reader users?
It follows the WAI-ARIA disclosure navigation pattern: real links and buttons in a nav landmark, aria-expanded on every toggle, aria-current for the current page, Escape to close and visible focus rings. Test it in the preview with Tab, Enter and Escape.
Can I use a logo instead of the brand text?
Yes. Enter the image address and it replaces the text, scaled to just over half the bar height. The brand name is used as the image's alternative text.
What is the difference between the panel and the drawer?
The panel pushes the menu open below the bar inside the page flow. The drawer slides in over the page from the right edge and suits longer menus, because it scrolls on its own.
How do I change the breakpoint later?
The breakpoint appears in two places, the min-width media query in the CSS and the matchMedia line in the script. Changing the number in the tool updates both.
Are my menu items stored online?
No. The design is kept in this browser's local storage. Use Save settings to keep a copy as a file.
