HTML <menu> Tag
In HTML4, the <menu> element has become obsolete; it is recommended that you use <ul> instead. In HTML5, the <menu> element is again included, but in a different quality. Now it acts as a container for the <command> element and the creation of the menu.
Description
The <menu>
HTML tag is used to define a list of commands or links within a specific context, such as within a context menu or a toolbar. It is typically used in conjunction with JavaScript or CSS to create interactive menus on web pages. The <menu>
tag itself does not provide any styling or behavior by default; it serves as a semantic wrapper for a list of menu items. Developers can use JavaScript to add interactivity, like showing or hiding the menu, or CSS to style the menu items. This tag is useful for creating accessible and structured menus on websites, ensuring a better user experience for visitors.
Properties
- Permitted Parents
- Any element that accepts flow content
- Content
- Flow content. If the element's children include at least one <li> element: Palpable content.
- Start/End Tags
- Start tag: required, End tag: required
Example
<menu>
<li>CSS</li>
<li>PHP</li>
<li>ASP</li>
</menu>
Attributes
Attribute | Definition |
---|---|
label | Specifies the label of the menu. It is used by the browser/user agent to to display nested menus |
type | Specifies the kind of menu being declared. Possible Values:
|
Global Attributes
The <menu>
tag also supports the Global Attributes in HTML5
Event Attributes
The <menu>
tag also supports the Event Attributes in HTML5
Browser Support
The following table will show you the current browser support for the HTML <menu>
tag.
Desktop | |||||
12 | 1 | 1 | 12.1 | 3 |
Tablets / Mobile | |||||
18 | 4 | 12.1 | 1 | 1 | 4.4 |
Last updated by CSSPortal on: 30th September 2023