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
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.
<menu> <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> </menu>
The purpose of the
menu element is mostly semantic. Styling in such cases is left in the hands of authors.
For information about global attributes refer to this list of global attributes in HTML5.
For information about global events refer to this list of global events in HTML5.