<menu> Tag in HTML
The <menu> tag in HTML represents a list or group of commands, typically rendered as a contextual menu. It can be used to display interactive options or a list of items in a structured format. The <menu>
tag was originally used for context menus, toolbars, and lists of commands, but now it’s primarily used for listing items.
Key Points on <menu> Tag:
- The
<menu>
tag defines a list of items or commands. - It can contain various list items and interactive elements.
- The
<menu>
tag is often styled as a list but can be customized with CSS for different layouts. - Supported in modern HTML but not commonly used due to limited styling and layout features.
Syntax of <menu> Tag:
Syntax Example
<menu>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</menu>
Example of <menu> Tag in HTML:
This example shows a simple menu listing items.
Code Example
<menu>
<li>Home</li>
<li>About Us</li>
<li>Services</li>
<li>Contact</li>
</menu>
Output
Attributes of <menu> Tag:
- type: Specifies the type of menu, like context, toolbar, or list.
- label: Provides a label for the menu, helpful for accessibility and descriptions.
The <menu>
tag is not widely used and may be styled differently across browsers. While it can represent lists of options or commands, consider using alternative list tags (<ul>
or <ol>
) for traditional lists, with added styles for interactive elements.