Name
menu — HTML 4.01 | HTML5
Synopsis
<menu> . . . </menu>
In HTML 4.01, the deprecated menu
element indicates a menu list, which
consists of one or more list items (li
). Menus were intended for a list of short
choices, such as a menu of links to other documents.
In HTML5, menu
represents a
list of interactive options or commands such as a menu of options in a
web application.
Start/End Tags
Required/Required
Attributes
Core, Internationalization, Events, HTML5 Global Attributes
compact
(compact="compact"
in XHTML)Deprecated. Not in HTML5. Makes the list as small as possible. Few browsers support the
compact
attribute.label="
text
"
HTML5 only. Specifies a label for the menu, which can be displayed in nested menus.
type="context|toolbar"
HTML5 only. Identifies the menu state.
context
indicates a context menu that can be accessed only when it is activated.toolbar
indicates the menu is to be used as a toolbar that can be interacted with immediately. If thetype
attribute is omitted, the default is merely a list of commands.
Example (HTML 4.01)
<menu> <li>About</li> <li>News</li> <li>Blog</li> <li>Contact</li> </menu>
Example (HTML5)
<menu> <command onclick="cut()" label="Cut"> <command onclick="copy()" label="Copy"> <command onclick="paste()" label="Paste"> <command onclick="delete()" label="Clear"> </menu>
Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.