YouTip LogoYouTip

Att Menu Type

## HTML <menu> type Attribute The `type` attribute of the `` element is used to specify the type of menu to be displayed. While the `` element itself represents a semantic list of interactive commands, the `type` attribute was introduced in HTML5 to define how those commands should be rendered and behave (e.g., as a standard list, a context menu, or a toolbar). --- ## Syntax ```html ``` ### Attribute Values | Value | Description | | :--- | :--- | | `list` | **Default.** Specifies a list menu. It represents a simple list of commands (using `
  • ` elements) that a user can perform or activate. | | `context` | Specifies a context menu (popup menu). The menu is typically hidden and only activated when a user performs a specific interaction (such as a right-click). | | `toolbar` | Specifies a toolbar menu. It represents an active row of commands that allows the user to immediately interact with the options. | --- ## Code Example The following example demonstrates a toolbar menu containing two dropdown menu buttons ("File" and "Edit"), each containing a series of interactive command options: ```html
  • ``` --- ## HTML 4.01 vs. HTML5 * **HTML 4.01:** The `` element was deprecated in HTML 4.01 in favor of the unordered list (`
      `) element. * **HTML5:** The `` element was redefined and reintroduced with the addition of the `type` attribute to support modern web application menus and context menus. --- ## Browser Support and Modern Considerations > **Important Warning:** > The `type` attribute of the `` element is **deprecated** and has been removed from the living HTML standard. Modern browsers do not support the `type="context"` or `type="toolbar"` behaviors. ### Current Best Practices * **Standard Lists:** If you want to create a list of interactive items, use the standard `` element (which behaves identically to `
        ` but carries semantic meaning for interactive menus) without the `type` attribute. * **Context Menus:** To implement custom right-click context menus, developers should use JavaScript (listening to the `contextmenu` event) combined with CSS and standard HTML elements (like `
        ` or ``) for maximum cross-browser compatibility and accessibility.
        ← Att Meta CharsetAtt Menu Label β†’