Posts in current category

HTML5 <menu> tag


May 03, 2021 17:00 HTML5


Table of contents


Instance

HTML5 is used to define menu lists.

Two examples of menu button series options ("File" and "Edit"):

<menu type="toolbar">
<li> 
<menu label="File"> 
<button type="button" onclick="file_new()">New...</button> 
<button type="button" onclick="file_open()">Open...</button> 
<button type="button" onclick="file_save()">Save</button> 
</menu></li>
<li> 
<menu label="Edit"> 
<button type="button" onclick="edit_cut()">Cut</button> 
<button type="button" onclick="edit_copy()">Copy</button> 
<button type="button" onclick="edit_paste()">Paste</button> 
</menu>
</li>
</menu>
Try it out . . .

Browser support

HTML5 <menu> tag HTML5 <menu> tag HTML5 <menu> tag HTML5 <menu> tag HTML5 <menu> tag

Currently, mainstream browsers do not support the hashtag.

Note: This element was deprecated in HTML4, but then HTML 5.1 (in drafting) is re-recommended.


Label definition and instructions for use

The label defines a list of commands or menus.

Labels are typically used for text menus, toolbars, and command list options.


Tips and comments

Tip: Use CSS to define menu list styles.


The difference between HTML 4.01 and HTML5

HTML 4.01's element is obsolete.

The elements in HTML5 have been redefined.


Property

New: HTML5 new property.

Property Value Describe
label New text The tag that describes the menu item.
type New context
toolbar
list
Describes the type of menu displayed. The default is list.

Global properties

The label supports global properties and views the full property sheet HTML global properties.


The event property

The label supports all HTML event properties.