HTML - <menu> Tag



HTML <menu> tag is used for creating a menu list of content. We can use the <li> tag to create list items inside of menu item.

HTML <menu> tag is deprecated in HTML4 and re-introduced in HTML5. But it is better to ignore this tag as it is experimental and not supported by many browsers.

Syntax

<menu>
  ...
  ...
<menu> 

Attribute

HTML menu tag supports Global and Event attributes of HTML. Accepts some specific attributes as well which are listed below.

Attribute Value Description
label html-5 text Specifies a visible label.
type html-5

popup

toolbar

context

Specifies the type of menu to be displayed.

Examples of HTML menu Tag

Bellow examples will illustrate the usage of menu tag. Where, when and how to use menu tag to create menu list.

Create menu Item using menu Tag

Let's look at the following example, where we are going to use the menu tag.

<!DOCTYPE html>
<html>

<head>
   <title>HTML menu Tag</title>
</head>

<body>
   <menu>
      <li>ol - Ordered list</li>
      <li>ul - Unordered list</li>
      <li>dir - Directory list</li>
      <li>menu - Menu list</li>
   </menu>
</body>

</html>

Styling menu Item using CSS

Here in this example we will style the menu element using internal CSS.

<!DOCTYPE html>
<html>

<head>
    <title>HTML menu Tag</title>
    <style>
        menu {
            display: flex;
            list-style: none;
            padding: 10px;
            width: 600px;
        }

        li {
            flex-grow: 1;
        }

        button {
            width: 100%;
            padding: 10px;
            background-color: lightgray;
            font-weight: 600;
        }
    </style>
</head>

<body>
    <menu>
        <li><button onclick="html()">HTML</button></li>
        <li><button onclick="css()">CSS</button></li>
        <li><button onclick="js()">JS</button></li>
    </menu>
</body>

</html>

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
menu Yes Yes Yes Yes Yes
html_tags_reference.htm
Advertisements