HTML Menu tag
The HTML <menu>
tag is used to define a list of commands or options that can be performed by the user. It is often used in conjunction with the HTML <command>
tag to create menus that allow users to perform actions on a web page.
Here is an example of how to use the <menu>
tag:
<menu>
<command type="checkbox" label="Option 1"></command>
<command type="checkbox" label="Option 2"></command>
<command type="radio" label="Option 3"></command>
<command type="radio" label="Option 4"></command>
<command type="radio" label="Option 5"></command>
</menu>
In this example, the <menu>
tag is used to define a list of options that the user can select. Each option is represented by a <command>
tag. The type
attribute of the <command>
tag can be set to checkbox
to create a checkbox option, or radio
to create a radio button option. The label
attribute of the <command>
tag specifies the text that will be displayed next to the checkbox or radio button.
The <menu>
tag also has several attributes that can be used to customize the appearance of the menu, including:
type
: Specifies the type of menu. The most common values for this attribute arecontext
(for context menus) andtoolbar
(for toolbars).label
: Specifies the label for the menu. This text is often used by screen readers to describe the menu to visually-impaired users.
Here’s an example of how to use these attributes:
<menu type="context" label="My Context Menu">
<command type="checkbox" label="Option 1"></command>
<command type="checkbox" label="Option 2"></command>
<command type="radio" label="Option 3"></command>
<command type="radio" label="Option 4"></command>
<command type="radio" label="Option 5"></command>
</menu>
In this example, the type
attribute is set to context
to create a context menu, and the label
attribute is set to “My Context Menu” to provide a label for the menu.
It is important to note that the <menu>
and <command>
tags are not widely supported by all browsers, so their use is not recommended for general web page design. However, they can be useful in certain situations, such as when creating custom toolbars or menus for web applications.