<menu>

The `<menu>` element lists commands or options but is mostly obsolete, with better semantic alternatives available.

The <menu> element in HTML is used to create a list of commands or options, typically for context menus, toolbars, or interactive lists. However, modern HTML offers better semantic alternatives for these use cases.

Syntax

index.html
<menu>
  <menuitem label="Command 1"></menuitem>
  <menuitem label="Command 2"></menuitem>
</menu>
The menu element
  • Coffee
  • Tea
  • Milk
  • index.html
    <h1>The menu element</h1>
    <menu>
      <li>Coffee</li>
      <li>Tea</li>
      <li>Milk</li>
    </menu>
    

    Definition and Usage

    The <menu> element represents an unordered list of commands or options. It works similarly to <ul>, often used alongside <li> to define individual menu items.

    Although <menu> can function like an unordered list, modern browsers typically treat it the same as the <ul> element.

    See Also

    • Related List Elements:
    • The contextmenu global attribute can reference a menu with the context type for interactive options.

    Conclusion

    The <menu> element was originally intended for creating lists of commands but has become mostly obsolete. While it can still be used for unordered lists, the <ul> element provides a more widely supported and consistent alternative. Modern web development generally relies on CSS and JavaScript for interactive menus.