Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML <menuitem> icon Attribute

Improve Article
Save Article
  • Last Updated : 31 Aug, 2022
Improve Article
Save Article

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. There are two types of URL links which are listed below:

  • Absolute URL: It points to another webpage.
  • Relative URL: It points to other files of the same web page.

Note: This attribute is depreciated from HTML 5.

Example: The below example illustrates the use of icon attribute in <menuitem> tag

HTML




<!DOCTYPE html>
<html>
 
<body>
    <center>
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
        <h2>HTML menuitem icon 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="Send it on...">
                    <menuitem label="Twitter" onclick="window.open(
'//twitter.com/intent/tweet?text='+ window.location.href);"
                        icon="ico_twitter.png">
                    </menuitem>
 
                    <menuitem label="Pinterest" onclick="window.open(
                        window.location.href);"
                            icon="ico_pinterest.png">
                    </menuitem>
                </menu>
                <menuitem label="Mail The current Page"
                    onclick="window.location='mailto:?body='
                    + window.location.href;" icon="ico_email.png">
                </menuitem>
            </menu>
        </div>
         
         
<p>A Computer Science Portal for Geeks</p>
 
        <hr>
         
<p>Right click on green div and see the menuitem </p>
 
    </center>
</body>
 
</html>


Output:

icon Attribute

Supported Browser: The icon attribute will only be supported in Firefox version 8.0.


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!