You build an HTML menu by combining a semantic list or navigation element with CSS layout, then adding interaction states and accessibility attributes so it works with a keyboard and screen reader. The minimum reliable pattern is a containing a of links, styled horizontally with flexbox and given visible focus styles. That holds for site navigation, a restaurant menu page, or an application menu bar.

Menu "design" in HTML means several different things, and they use overlapping but not identical techniques. A website navigation menu is a list of page links. A restaurant menu is content: dishes, prices, descriptions, sometimes dietary labels. An application menu (like a File/Edit bar) is a widget with roles and keyboard behavior borrowed from desktop software. This guide covers all three, but it starts with the pattern that applies to nearly every case—the site navigation menu—because it is the most common request and the one most likely to go wrong. Where the other two diverge, the differences are spelled out.

The examples assume you're working with HTML5 and modern CSS. They avoid frameworks so the mechanics stay visible; the same principles apply when you port them into React or a CMS template.

Start with semantic HTML before any CSS

The most common failure in menu design is reaching for styling before the markup is correct. If the underlying HTML is a pile of elements with click handlers, no amount of CSS will make the result accessible or robust. Semantic HTML gives you keyboard behavior, screen reader announcements, and text-only fallbacks for free.

For site navigation, the standard structure is a navigation landmark wrapping an unordered list of links:

Three choices here matter. First, creates a landmark that assistive technology users can jump to; if you have more than one nav (primary and footer, for example), the aria-label distinguishes them. Second, the conveys that these items form a set, and screen readers announce the number of items. Third, each destination is a real with an href, which means it is focusable, activates with Enter, can be opened in a new tab, and shows a URL on hover. You will see examples that put the nav links directly inside without a list. That's valid HTML and can work, but it loses the item count and list semantics that help screen reader users. Use the list unless you have a specific reason not to. For a restaurant menu, the semantic choice is different: the menu is content, and the natural structure is headings for courses and a list or definition-style grouping for dishes. A is sometimes appropriate when items have aligned price and description columns, but tables imply a grid relationship between rows and columns that a menu doesn't really have; a styled list usually reads better. Reserve tables for genuine tabular data. An application menu bar is a different animal and gets its own section later, because it needs ARIA roles and scripted keyboard handling that a plain link list does not. Lay out the menu horizontally with flexbox A vertical list of links is the default; navigation menus are almost always laid out horizontally on wide screens. Flexbox handles this in a few lines and degrades predictably. The key properties: display: flex puts items in a row; flex-wrap: wrap lets them flow to a second line instead of overflowing when the viewport narrows; gap replaces the old margin hacks and keeps spacing consistent; and list-style: none plus zeroed margin and padding removes the bullets and indentation. Note that setting display: block on the link makes the entire padded area clickable, which improves both usability and touch targets—a link that is only as tall as its text is harder to hit on a phone. Flexbox is the right default because it handles variable-length labels, wrapping, and alignment without fixed widths. If you need items distributed evenly across the full width, justify-content: space-between works; for evenly sized items, flex: 1 on each li does it. CSS Grid is a reasonable alternative when you want two-dimensional control, but for a single row of links it adds complexity without benefit. For a restaurant menu, the layout problem is two-column alignment: dish name and description on the left, price on the right. A common approach is a flex container per item with justify-content: space-between, or a dotted leader between name and price created with a repeating background or a border-bottom on a flexible spacer element. Both are stable; the flex approach is easier to maintain. Design the visual states: rest, hover, focus, active, current A menu design is defined as much by its states as its default appearance. There are five you need to handle, and skipping any of them creates a real usability gap. Rest is the default link appearance. Keep contrast high: WCAG 2.2 requires a contrast ratio of at least 4.5:1 for normal-size text against its background, and 3:1 for large text (roughly 18pt regular or 14pt bold). Menu links are usually small, so aim for 4.5:1. Hover gives pointer users feedback. A color change or an underline appearing is enough; avoid motion that could distract. Focus is the state keyboard users rely on, and it is the one most often erased. Never write outline: none without a replacement. The browser default focus ring is serviceable; if you restyle it, ensure the replacement is clearly visible against both light and dark backgrounds. A reliable pattern is a custom outline offset from the text: Using :focus-visible rather than :focus shows the ring for keyboard navigation but not for mouse clicks, which avoids the ring flashing on every click without hiding it from keyboard users. Active (the moment of clicking) is a minor state; a slight color shift suffices. Current marks the page the user is on. This is best expressed in the markup with aria-current="page" on the relevant link, then styled: Relying on aria-current rather than a visual-only class means screen reader users are told "current page" when they reach the link, which a bold font alone would not convey. Don't rely on color alone to indicate the current item—WCAG 1.4.1 requires that color isn't the sole means of conveying information—so pair it with weight, an underline, or a border. Build a dropdown submenu that works without a mouse Dropdown menus are where most hand-built navigation fails. The naive approach—hide a submenu with display: none and show it on :hover—works for mouse users and is completely unusable for keyboard and touch users. A correct implementation needs the submenu reachable by keyboard, dismissible, and clearly associated with its trigger. The simplest robust pattern uses a / element, which browsers make keyboard-operable by default: opens on click or Enter/Space and closes the same way; no JavaScript is required. The trade-off is that it opens on click rather than hover, and styling the marker takes a little CSS (summary::-webkit-details-marker and list-style: none on the summary). For many sites that trade-off is worth it for the built-in accessibility. If you need hover-open behavior, you can layer it on with CSS for pointer devices while keeping click/keyboard behavior intact: But be careful: CSS-only hover opening does not close the menu when focus leaves, and it can leave a submenu stuck open. The more reliable approach for hover menus is a small script that toggles a class and manages aria-expanded on the trigger button, closing the submenu on Escape and when focus moves outside. Whichever route you take, the submenu must be reachable by Tab, the trigger must expose its expanded state, and Escape must close it. That is the checklist; the implementation detail is secondary. Menu depth beyond one submenu level is a design smell. Deep nesting is hard to operate on touch and confusing in screen readers; restructure the information architecture instead. Make the menu responsive without duplicating content On narrow screens a horizontal row of links either wraps into an awkward block or overflows. The conventional solution is a "hamburger" toggle that reveals a vertical menu. Two rules keep this from becoming a maintenance and accessibility problem. First, don't maintain two copies of the menu. The pattern that avoids duplication is a single list whose presentation changes at a breakpoint, with a toggle button shown only on small screens. If you must hide the desktop version and show a separate mobile version, at least ensure only one is in the accessibility tree at a time (using display: none, not visibility: hidden or off-screen positioning, so hidden duplicates aren't announced). Second, the toggle is a real button with an accessible name and state: The label "Menu" is clearer than an unlabeled hamburger icon for screen reader users; if you use only an icon, give the button an aria-label. The script flips aria-expanded between true and false when toggled, and CSS keys off it to show or hide the list. When the menu is open, focus should be able to move into it, and Escape should close it and return focus to the button. A simple, reliable version: This is the minimum. It does not trap focus inside an open overlay, which is acceptable for a simple dropdown that pushes content down but not for a full-screen overlay menu. If your mobile menu covers the whole screen, focus management becomes mandatory: focus should move into the menu on open and return to the toggle on close, and background content should be inert. Structure a restaurant menu page for scanning A restaurant menu is a reading task before it is a visual one. Diners scan for categories, then for dishes, then for prices and dietary suitability. The HTML should encode that hierarchy. Use a heading per course— Starters , Mains —so screen reader users can navigate by heading. Group each dish in a way that keeps its name, description, and price associated. A definition list or a list of items each containing a heading and paragraph both work: Dietary and allergen labels should be text, not color dots alone. A green dot for vegetarian means nothing to a screen reader and little to a colorblind diner. If you use symbols, include a visible legend and a text alternative for each label. Allergen information is health-relevant; where local rules require it, the menu must state it in text, and the digital menu should not be less informative than the printed one. Prices should be in a consistent format and, if the menu spans currencies or service charges, a note should explain. None of this is strictly "design," but a menu that looks clean and omits a diner's ability to find safe food has failed. Build an application menu bar with correct roles If you're building something that behaves like a desktop application—File, Edit, View, with dropdowns containing commands—you're in widget territory. HTML has no native menu bar, so you use ARIA roles and manage keyboard behavior yourself. This is a real engineering task, not a styling task. The core pattern: a container with role="menubar", each top-level item as role="menuitem" (or a button with that role), each dropdown as role="menu", and each command inside as role="menuitem". The expected keyboard behavior is specific and non-obvious: Left/Right arrows move between top-level items, Down opens a menu and moves into it, Up/Down move within an open menu, Escape closes and returns focus, and Home/End jump to the first and last items. Tab usually leaves the menu bar entirely rather than stepping through every item. Implementing this correctly is more involved than the rest of this guide, and errors are common—partially implemented menubars that respond to some keys but not others are worse than a simple list of links, because they advertise capabilities they don't deliver. Before building one, check whether the ARIA Authoring Practices Guide's menubar pattern fits your case, and consider whether a list of regular links styled as a toolbar would meet the need with far less code and far fewer accessibility failure modes. For most web applications, a navigation of plain links or buttons is the better choice; reserve the true menubar role for interfaces that genuinely mimic desktop software. Test the menu before you ship A menu can look perfect in a screenshot and still be broken. These checks take a few minutes and catch the failures that matter. 1: Tab through the menu. Can you reach every link? Is the focus ring visible on each one against the actual background? If a dropdown exists, can you open it and reach its items with the keyboard alone? 2: Operate with the keyboard only. Press Enter on links and Space/Enter on buttons. Open any submenu, then press Escape—does it close and return focus sensibly? 3: Check contrast. Sample the link color against its background with a contrast checker; confirm at least 4.5:1 for normal text. Also check the focus indicator against both the link background and the page background. 4: Zoom to 200%. Text should reflow without clipping or horizontal scrolling for the menu itself; WCAG 1.4.4 requires this for most content. 5: Test at a narrow width. Confirm the responsive toggle appears, opens, closes, and that the closed menu isn't still focusable off-screen. 6: Run a screen reader spot check. With VoiceOver (macOS) or NVDA (Windows), listen to how the navigation is announced: the landmark name, the list and its item count, the current-page indication, and the expanded/collapsed state of any toggle. If any of these fail, fix that before adding visual polish. A menu that looks refined but traps keyboard users is a regression, not a design. The boundary where you should stop and involve someone else: if your menu is part of a design system that must meet a contractual accessibility standard (for example, a public-sector site bound to WCAG 2.2 AA), get an accessibility specialist to review the completed component rather than relying on these checks alone. Automated tools catch only a fraction of issues; the keyboard and screen reader passes catch more, but a formal audit is the reliable confirmation. Common mistakes and how to avoid them Using divs and click handlers instead of links. A is not focusable, not announced as a link, and not openable in a new tab. Usefor navigation and for actions that don't navigate. This single rule prevents a large share of menu bugs. Removing focus outlines. outline: none is the most common accessibility regression in navigation. If the default ring clashes with your design, replace it with something equally visible, not with nothing. Icon-only toggles without names. A hamburger icon with no text and no aria-label is announced as "button" with no purpose. Add a label. Duplicating the menu for mobile and desktop. Two copies drift out of sync and double the screen reader clutter. Use one list and change its presentation. Relying on hover for submenus. Touch devices have no hover, and keyboard users can't trigger it. Provide a click/keyboard path. Color-only state cues. A current page marked only by a color change is invisible to some users. Add weight, underline, or a border, and use aria-current. Each of these is a small fix, and together they separate a menu that merely renders from one that actually works. FAQ Do I need JavaScript for a dropdown menu? Not necessarily. / provides a keyboard-operable disclosure with no script. You only need JavaScript if you want hover-open behavior that also closes correctly on focus loss and Escape, or if you're building a full application menubar with arrow-key navigation. Should navigation use or ? Use for site navigation. The element is not for navigation menus; it represents a list of commands or toolbar items and has limited, inconsistent support. For a list of links, with a is the correct semantic choice. How many top-level menu items should there be? There's no hard limit, but readability and touch-target spacing constrain it in practice—roughly five to seven top-level items fit comfortably on a desktop row and remain scannable. If you need more, group related pages under a dropdown or reconsider the information architecture rather than shrinking the text. Is a table appropriate for a restaurant menu with prices? Usually not. A table implies a row-column relationship that a dish list doesn't have, and it complicates responsive layout. A list with flex-aligned names and prices is more flexible and reads better with assistive technology. Reserve tables for genuinely tabular data.