HTML menuitem: Main Tips
<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
commandattribute to connect to other commands.
menuitemtag 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:
<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:
|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).|
Mobile browser support
Latest Coupon Found:
TOP-RATED CODING COURSES
Learn the skills of tomorrow
The best time to learn programming is now - follow this link to access 100+ coding courses and enjoy learning at a very low cost!