Code has been added to clipboard!

HTML menuitem Tag

Reading time 2 min
Published Jun 29, 2017
Updated Oct 2, 2019

HTML menuitem: Main Tips

  • HTML <menuitem> tag was used to declare a command which the user could request from a popup menu.
  • To set up a new command, you could utilize one or multiple of tag-specific attributes.
  • You could also use the command attribute to connect to other commands.
  • HTML menuitem tag has been deprecated since HTML 5.2.

What <menuitem> Meant

Now unsupported HTML menuitem element defined a command to invoke from the popup menu by the user:

Example
<img src="https://cdn.bitdegree.org/learn/pom-laptop.png?raw=true" id="doggo" width="250" alt="Space Doggo" contextmenu="sunmenu">

<menu type="context" id="sunmenu">
    <menuitem label="Zoom In" icon="https://github.com/bitdegree/banners/blob/master/banners/html_small.png?raw=true" onclick="zoomin()">
    <menuitem label="Zoom Out" icon="https://github.com/bitdegree/banners/blob/master/banners/html_small.png?raw=true" onclick="zoomout()">
    <menuseparator/>
    <menuitem label="Reload Image" icon="https://github.com/bitdegree/banners/blob/master/banners/html_small.png?raw=true" onclick="window.location.reload();">
</menu>

In the example above, you can also see a <menuseparator/> tag which created a HTML menuitem separator. It was a thin line separating the possible commands. When creating a website, HTML menuitem separator could be used to group similar options to simplify the user experience.

Tag Attributes Used With HTML menuitem

There were seven tag-specific attributes to the now unsupported HTML menuitem. See them in the table below:

Attribute Description
radiogroup Defined the name of a group of commands to toggle.
checked Identified the element as checked when the page was loading.
default Set a command as the default one for menuitem.
disabled Disabled the menuitem.
icon Defined an icon for a specific menuitem.
label Defined the menuitem's name to show to the user.
command Indicated the ID of an individual element, pointing to a command to be requested indirectly.
type Defined the menuitem type (command by default).

Browser support

Chrome
-
Edge
-
Firefox
8+
IE
-
Opera
-
Safari
-

Mobile browser support

Chrome
-
Firefox
8+
Opera
-
Safari
-
Basics
Introduction
Syntax
Editors
Basic Examples
Head Section
<!DOCTYPE>
Tags and Elements
Semantic Elements
Tags Reference
Attributes
Comments
Block and Inline Elements
Forms
Form Elements
Input
Responsive Web Design
Inline Scripts
Uniform Resource Locator
Redirect
XHTML
Geolocation
Drag and Drop
Local Storage
Web Workers
Server-Sent Events
Character Encoding
Text Formatting
Quotation and Citation Elements
Headings
Paragraphs
Links
Tables
Lists
Symbols
Space
Tab
Styles
Computer Code
Layout
Classes
Colors
Images
iframes
Audio Player
Video Player
YouTube Videos
Multimedia
Canvas
SVG
<!-- -->
<a>
<abbr>
<acronym> DEPRECATED
<address>
<applet> DEPRECATED
<article>
<aside>
<audio>
<b>
<base>
<basefont> DEPRECATED
<bdi>
<bdo>
<big> DEPRECATED
<blink> DEPRECATED
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center> DEPRECATED
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir> DEPRECATED
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font> DEPRECATED
<footer>
<form>
<frame> DEPRECATED
<frameset> DEPRECATED
<h1> – <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<keygen> DEPRECATED
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<menu>
<menuitem> DEPRECATED
<meta>
<meter>
<nav>
<noframes> DEPRECATED
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike> DEPRECATED
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt> DEPRECATED
<u>
<ul>
<var>
<video>
<wbr>