👀 Live Preview
A styled toolbar menu pattern (visual demo — not native browser menu behavior):

The <menu> tag has a varied history in HTML. This guide explains its purpose, syntax, limited browser support, and the modern alternatives beginners should use.
Wrap <li> items inside opening and closing <menu> tags.
Deprecated in HTML4, reintroduced in HTML5 with a different role.
Use type for context, toolbar, or list menus and label for toolbars.
Context menus, toolbar menus, and command lists in web applications.
Build menus with <nav>, <ul>, and JavaScript.
Understand why limited support makes menu rare in production.
<menu> Tag?The <menu> element is an HTML tag originally intended to create context menus, toolbar menus, and lists of commands. It contains <li> elements that represent individual menu actions.
The <menu> tag was deprecated in HTML4 but brought back in HTML5 with a slightly different meaning. Support and functionality vary widely across browsers, so it is rarely used in modern web development.
Over time, developers shifted to <nav> with <ul> for site navigation and JavaScript-driven context menus for right-click actions. Learn menu to read legacy code; use proven alternatives in new projects.
Wrap your list items between opening and closing <menu> tags:
<menu>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</menu><menu> requires both opening and closing tags.<li> elements (or <menuitem> in older specs).type and label attributes for toolbar and context menu patterns.<menu type="toolbar" label="File">
<li>Open</li>
<li>Save</li>
<li>Close</li>
</menu>| Pattern | Code Snippet | Notes |
|---|---|---|
| Basic menu | <menu><li>Item</li></menu> | Simple command list |
| Toolbar | type="toolbar" label="File" | App toolbar group |
| Context menu | type="context" | Right-click menu |
| List type | type="list" | General item list |
| Modern nav | <nav><ul><li>...</li></ul></nav> | Recommended for sites |
| Browser support | Limited | Prefer nav + ul |
The <menu> tag supports several attributes that customize its behavior:
type Menu typeSpecifies the menu kind: context (right-click), toolbar (app toolbar), or list (general commands).
type="toolbar"label LabelProvides a visible label for the menu, especially useful when type="toolbar".
label="File"class / id GlobalHook for CSS styling and JavaScript that shows or hides context menus.
id="context-menu"Toolbar menus, context menus, command lists, and the recommended nav alternative. Demos use CSS styling because native menu behavior is unreliable in modern browsers.
A styled toolbar menu pattern (visual demo — not native browser menu behavior):
A file toolbar with type="toolbar" and label="File".
<menu type="toolbar" label="File">
<li>Open</li>
<li>Save</li>
<li>Close</li>
</menu>The <menu> tag was designed for custom context menus on right-click, toolbar menus in web applications, and general lists of commands. In practice, JavaScript context menus and nav navigation are far more reliable.
Create a custom context menu that appears when a user right-clicks an element.
<menu type="context" id="context-menu">
<li>Cut</li>
<li>Copy</li>
<li>Paste</li>
</menu>
<div oncontextmenu="showMenu(event)">Right-click me!</div>Define an edit toolbar for a web application with undo, redo, and find commands.
<menu type="toolbar" label="Edit">
<li>Undo</li>
<li>Redo</li>
<li>Find</li>
</menu>Use a plain <menu> to list commands or actions in a web application.
<menu>
<li>Reload</li>
<li>Settings</li>
<li>Help</li>
</menu>For site navigation, use <nav> with an unordered list — widely supported and accessible.
<nav aria-label="Main navigation">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>Given the limited support and potential complications with the <menu> tag, use these proven patterns instead:
<ul>) — For most cases where a list of items is needed.<nav> and <ul> — Build accessible, widely supported toolbar and site navigation.<nav aria-label="Main">
<ul>
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>Menus must be operable by keyboard and screen reader users:
nav for site navigation — Landmark roles help assistive technology find menus quickly.aria-label — Name navigation regions when multiple menus exist on a page.menu alone — Limited browser support means many users see an unstyled list with no interaction.Wrap <li> commands inside <menu> with optional type and label.
Supporting browsers display toolbar or context menu chrome. Most modern browsers render a plain list instead.
Right-click handlers call functions like showMenu(event) to position and display the menu.
Learn menu for legacy HTML. Build navigation with nav and accessible JavaScript patterns.
Understanding compatibility across browsers is essential. The <menu> tag has very limited support — consider whether it is essential or if alternatives are more appropriate.
Only partial support in some Chromium versions. Firefox, Safari, Edge, and Opera do not implement context or toolbar menu UI from the menu tag.
Bottom line: Test in all target browsers. For production menus, use <nav> with <ul> or custom JavaScript context menus.
While the <menu> tag offers specific functionalities for context and toolbar menus, its limited browser support and historical deprecation necessitate careful consideration.
In most cases, modern alternatives — <nav> with <ul> for navigation and JavaScript for context menus — provide more reliable and widely supported solutions. Evaluate your project requirements and choose the most appropriate method.
nav + ul for site navigationmenu UI in productionul with menu without a clear benefit<menu>Bookmark these before you build navigation or context menus.
<menu> wraps <li> menu items.
Deprecated, then reintroduced with new semantics.
Historycontext, toolbar, or list.
Most browsers skip native menu UI.
Compatibilitynav + ul for site menus.
Custom context menus need keyboard support.
A11y<li> items.nav is for major site navigation. menu was for toolbars and context menus. Use nav for websites.context, toolbar, or list. Support is unreliable in modern browsers.nav with ul for navigation, and JavaScript + CSS for custom context menus.Skip unreliable menu UI. Practice accessible nav navigation in the Try It editor.
6 people found this page helpful