HTML <menu> Tag

Beginner
⏱️ 7 min read
📚 Updated: Jun 2026
🎯 5 Examples
Navigation

What You’ll Learn

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.

01

Core Syntax

Wrap <li> items inside opening and closing <menu> tags.

02

Historical Status

Deprecated in HTML4, reintroduced in HTML5 with a different role.

03

type & label

Use type for context, toolbar, or list menus and label for toolbars.

04

Common Use Cases

Context menus, toolbar menus, and command lists in web applications.

05

Modern Alternatives

Build menus with <nav>, <ul>, and JavaScript.

06

Browser Reality

Understand why limited support makes menu rare in production.

What Is the <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.

⚠️
Deprecated in HTML4 — Reintroduced in HTML5

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.

📝 Syntax

Wrap your list items between opening and closing <menu> tags:

syntax.html
<menu>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</menu>

Syntax Rules

  • <menu> requires both opening and closing tags.
  • Child items are typically <li> elements (or <menuitem> in older specs).
  • Add type and label attributes for toolbar and context menu patterns.
  • Always provide accessible fallbacks because browser support is limited.
toolbar-menu.html
<menu type="toolbar" label="File">
  <li>Open</li>
  <li>Save</li>
  <li>Close</li>
</menu>

⚡ Quick Reference

PatternCode SnippetNotes
Basic menu<menu><li>Item</li></menu>Simple command list
Toolbartype="toolbar" label="File"App toolbar group
Context menutype="context"Right-click menu
List typetype="list"General item list
Modern nav<nav><ul><li>...</li></ul></nav>Recommended for sites
Browser supportLimitedPrefer nav + ul

🧰 Attributes

The <menu> tag supports several attributes that customize its behavior:

type Menu type

Specifies the menu kind: context (right-click), toolbar (app toolbar), or list (general commands).

type="toolbar"
label Label

Provides a visible label for the menu, especially useful when type="toolbar".

label="File"
class / id Global

Hook for CSS styling and JavaScript that shows or hides context menus.

id="context-menu"

Examples Gallery

Toolbar menus, context menus, command lists, and the recommended nav alternative. Demos use CSS styling because native menu behavior is unreliable in modern browsers.

👀 Live Preview

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

File
  • Open
  • Save
  • Close

Toolbar Menu

A file toolbar with type="toolbar" and label="File".

⚠️ Limited browser support — test in target browsers or use nav + ul instead.
file-toolbar.html
<menu type="toolbar" label="File">
  <li>Open</li>
  <li>Save</li>
  <li>Close</li>
</menu>
Try It Yourself

📚 Common Use Cases

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.

Context Menus

Create a custom context menu that appears when a user right-clicks an element.

context-menu.html
<menu type="context" id="context-menu">
  <li>Cut</li>
  <li>Copy</li>
  <li>Paste</li>
</menu>
<div oncontextmenu="showMenu(event)">Right-click me!</div>
Try It Yourself

Toolbar Menus

Define an edit toolbar for a web application with undo, redo, and find commands.

edit-toolbar.html
<menu type="toolbar" label="Edit">
  <li>Undo</li>
  <li>Redo</li>
  <li>Find</li>
</menu>
Try It Yourself

Lists of Commands

Use a plain <menu> to list commands or actions in a web application.

command-list.html
<menu>
  <li>Reload</li>
  <li>Settings</li>
  <li>Help</li>
</menu>
Try It Yourself

Recommended Alternative: nav + ul

For site navigation, use <nav> with an unordered list — widely supported and accessible.

nav-alternative.html
<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>
Try It Yourself

🔄 Alternatives

Given the limited support and potential complications with the <menu> tag, use these proven patterns instead:

  • Unordered lists (<ul>) — For most cases where a list of items is needed.
  • Context menus with JavaScript — Create custom right-click menus using JavaScript and CSS for greater control and compatibility.
  • Toolbar menus with <nav> and <ul> — Build accessible, widely supported toolbar and site navigation.
nav-alternative.html
<nav aria-label="Main">
  <ul>
    <li>Home</li>
    <li>About</li>
    <li>Contact</li>
  </ul>
</nav>

♿ Accessibility

Menus must be operable by keyboard and screen reader users:

  • Use nav for site navigation — Landmark roles help assistive technology find menus quickly.
  • Add aria-label — Name navigation regions when multiple menus exist on a page.
  • Keyboard support — Custom context menus need focus traps, Escape to close, and arrow-key navigation.
  • Do not rely on menu alone — Limited browser support means many users see an unstyled list with no interaction.

🧠 How <menu> Works

1

Author defines menu items

Wrap <li> commands inside <menu> with optional type and label.

Markup
2

Browser renders menu UI

Supporting browsers display toolbar or context menu chrome. Most modern browsers render a plain list instead.

Rendering
3

JavaScript may trigger context menus

Right-click handlers call functions like showMenu(event) to position and display the menu.

Interaction
=

Today: use nav + ul or JS menus

Learn menu for legacy HTML. Build navigation with nav and accessible JavaScript patterns.

Browser Support

Understanding compatibility across browsers is essential. The <menu> tag has very limited support — consider whether it is essential or if alternatives are more appropriate.

Limited · Unreliable

Most browsers ignore native menu behavior

Only partial support in some Chromium versions. Firefox, Safari, Edge, and Opera do not implement context or toolbar menu UI from the menu tag.

~15% Native menu UI
Google Chrome Partial support · Plain list fallback
Partial
Mozilla Firefox No native menu UI
Not supported
Apple Safari No native menu UI
Not supported
Microsoft Edge No native menu UI
Not supported
Internet Explorer No support · EOL
Not supported
Opera No native menu UI
Not supported
<menu> tag Limited support

Bottom line: Test in all target browsers. For production menus, use <nav> with <ul> or custom JavaScript context menus.

Conclusion

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.

💡 Best Practices

✅ Do

  • Provide fallback content for unsupported browsers
  • Test menu behavior in all target browsers
  • Use nav + ul for site navigation
  • Build context menus with accessible JavaScript

❌ Don’t

  • Depend on native menu UI in production
  • Replace ul with menu without a clear benefit
  • Forget keyboard navigation on custom menus
  • Assume right-click menus work from HTML alone

Key Takeaways

Knowledge Unlocked

Six truths every developer should know about <menu>

Bookmark these before you build navigation or context menus.

6
Core concepts
⚠️ 02

HTML4 → HTML5

Deprecated, then reintroduced with new semantics.

History
⚙️ 03

type Attribute

context, toolbar, or list.

Attributes
🚫 04

Limited Support

Most browsers skip native menu UI.

Compatibility
🗺️ 05

Use nav Instead

nav + ul for site menus.

Alternative
06

Accessible JS

Custom context menus need keyboard support.

A11y

❓ Frequently Asked Questions

It creates context menus, toolbar menus, and lists of commands by wrapping <li> items.
It was deprecated in HTML4, reintroduced in HTML5, but has very limited browser support today.
nav is for major site navigation. menu was for toolbars and context menus. Use nav for websites.
Values are context, toolbar, or list. Support is unreliable in modern browsers.
nav with ul for navigation, and JavaScript + CSS for custom context menus.

Build Menus the Modern Way

Skip unreliable menu UI. Practice accessible nav navigation in the Try It editor.

Try nav Alternative →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful