HTML Tags
Advertisements

HTML <menu> Tag

Topic: HTML5 Tags ReferencePrev|Next

Description

The <menu> element defines a list (or menu) of commands that a user can perform.

The following table summarizes the usages context and the version history of this tag.

Placement: Block
Content: <menu>, <menuitem>, <li>, <hr> and <script>
Start/End Tag: Start tag: required, End tag: required
Version: HTML 2, 3.2, 4, 4.01, 5

Note: The <menu> tag was deprecated in HTML 4.01, but reintroduced in HTML5. However, it is better to avoid using this tag, because it is not supported by the major web browsers like Chrome, IE, Safari and Opera.


Syntax

The basic syntax of the <menu> tag is given with:

HTML / XHTML: <menu> ... </menu>

The example below shows the <menu> tag in action.

<img src="sky.jpg" id="sky" width="250" alt="Cloudy Sky" contextmenu="skymenu">
<menu type="context" id="skymenu">
    <menuitem label="Zoom In" icon="zoom-in.png" onclick="zoomin()">
    <menuitem label="Zoom Out" icon="zoom-out.png" onclick="zoomout()">
    <menuitem label="Reload Image" icon="reload.png" onclick="window.location.reload();">
</menu>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <menu> tag.

Attribute Value Description
label text Specifies a visible label of the menu.
type popup
toolbar
context
Specifies which type of menu to display.

Global Attributes

Like all other HTML tags, the <menu> tag supports the global attributes in HTML5.


Event Attributes

The <menu> tag also supports the event attributes in HTML5.


Browser Compatibility

The <menu> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 8+ (only context menu)
  • Google Chrome ×
  • Internet Explorer ×
  • Apple Safari ×
  • Opera ×

Further Reading

See tutorial on: HTML Lists.

Related tags: <ol>, <ul>, <li>.

Advertisements
Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties