HTML contextmenu Attribute Last Updated : 30 Aug, 2024 Comments Improve Suggest changes Like Article Like Report HTML contextmenu attribute is a global attribute that will be used to define a context-menu bar for an element. The value of the contextmenu attribute must be the same as the id of the <menu> element. So basically, A context menu seems upon user relations, such as when a user right-clicks on the element. As know HTML5 allows us to customize this menu. Here are some implementation examples, including nested menus. Note: HTML contextmenu Attribute is not supported in HTML5.Syntax:<element contextmenu="menu_id">Attribute Values: It contains the value menu_id which represents the id of the <menu> element to be opened. Examples of HTML contextmenu AttributeExample: HTML code below illustrates the use of contextmenu attribute. HTML <!DOCTYPE html> <html> <head> <title>HTML contextmenu attribute </title> <style> h1 { color: green; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <h2>HTML contextmenu attribute</h2> <div style="background:green;border:2px solid #black;padding: 10px;" contextmenu="geeks"> <p>A Computer Science Portal for Geeks</p> <menu type="context" id="geeks"> <menu label="Share on..."> <menuitem label="Twitter" onclick= "window.open('//twitter.com/intent/tweet?text=' + window.location.href);"> </menuitem> <menuitem label="Pinterest" onclick= "window.open('http://pinterest.com/pin/create/button/?url=' + window.location.href);"> </menuitem> </menu> <menuitem label="Email This Page" onclick= "window.location='mailto:?body='+window.location.href;"> </menuitem> </menu> </div> <p>A Computer Science Portal for Geeks</p> <hr> <p>Right click on green div and see the menuitem </center> </body> </html> Output: HTML contextmenu AttributeSupported Browsers: HTML contextmenu Attribute no longer supports any browsers. Comment More infoAdvertise with us Next Article HTML contextmenu Attribute M manaschhabra2 Follow Improve Article Tags : HTML HTML-Attributes Similar Reads HTML | oncontextmenu Event Attribute This attribute works when the user right-clicks on an element to open the context menu.Supported Tags: It supports all HTML elements. Syntax: <element oncontextmenu="script"> Attribute Value: This attribute contains single value script. The script to be run when oncontextmenu attribute called. 1 min read HTML <menuitem> icon Attribute The HTML <menuitem> icon Attribute is used to define the pictorial representation of the menu command or menu item. It contains the URL of a specified image. Syntax: <menuitem icon="URL">Attribute Values: It contains a single value URL that specifies an icon for a particular menu item. T 1 min read HTML Global Attributes HTML attributes provide additional information about an element and define its properties. Global attributes are special types of attributes that can be used with any HTML element, offering common functionality to enhance behavior and presentation.Global attributes can be applied to any HTML element 5 min read HTML Attributes Complete Reference HTML attributes are special words placed inside the opening tag of an HTML element to define its characteristics. Each attribute has two parts:Attribute nameAttribute value (separated by an equal sign = and enclosed in double quotes " ").Syntax:<tag_name attribute_name="value"> Contents... 8 min read HTML <menu> type Attribute The type attribute in <menu> element is used to define the type of menu bar. It is also used with the <menuitem> tag which defines the type of commands of the menu items. Syntax: <menu type="list|context|toolbar">Note: This attribute has been deprecated and is no longer used. Attr 1 min read Like