menu element

If you don't know what an element is or how you must use it, I recommend you read the "HTML tags and attributes" tutorial that you can find in the HTML tutorials section.


The menu element represents a toolbar that consists of a list of commands represented by an unordered list of items (li elements). This element is simply a semantic alternative to the ul element used to represent an unordered list of commands.


In the following example, we'll insert a toolbar menu that's pretending to be the menu bar in a text editor. The commands listed in this menu will lead to no action, but the example will still be sufficient to depict the functionality of the menu element. As stated before, each item in the menu is represented by a list item (li element) containing a button.

The functions declared in the following example aren't meant to work. This example aims only to test the functionality provided by browsers for menus.

  <li><button onclick="new()">New...</button></li>
  <li><button onclick="open()">Open...</button></li>
  <li><button onclick="save()">Save</button></li>
  <li><button onclick="saveas()">Save as...</button></li>
  • The purpose of the menu element is mostly semantic. Styling in such cases is left in the hands of authors.


    Global attributes

    For information about global attributes refer to this list of global attributes in HTML5.


    Global events

    For information about global events refer to this list of global events in HTML5.