Skip to main content

HTML Tags

HTML <menu> Tag

Written by Updated HTML <menu> Tag exercises

Learn how the HTML <menu> tag represents a toolbar containing an unordered list of commands.

The menu tag is a list of commands, like a toolbar: Save, Share, Print. It works exactly like a ul, with li items inside, but tells the browser the items are actions rather than ordinary list content.

For a list of links to other pages, use <nav> with a list inside. For a normal bulleted list, use the ul tag. <menu> is for groups of buttons that do something on the current page.

Syntax

html

<menu>
  <li><button type="button">Save</button></li>
  <li><button type="button">Share</button></li>
</menu>

It has no attributes of its own, only the global ones such as class and id. The old type and label attributes for context menus were removed from HTML.

Example

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Menu Tag Example</title>
  <style>
    menu {
      display: flex;
      gap: 10px;
      list-style: none;
      padding: 0;
    }

    menu button {
      border: 0;
      border-radius: 6px;
      background-color: #29AB87;
      color: white;
      padding: 10px 16px;
      cursor: pointer;
    }

    menu button:hover {
      background-color: #218c70;
    }
  </style>
</head>
<body>
  <h1>Article Actions</h1>

  <menu>
    <li><button type="button">Save</button></li>
    <li><button type="button">Share</button></li>
    <li><button type="button">Print</button></li>
  </menu>
</body>
</html>

Three green buttons, Save, Share and Print, appear side by side. The CSS removes the bullets and lays the list out in a row with Flexbox.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

Good to know

  • Each item is an <li>, usually holding a <button>. Buttons, not links, because they perform actions.
  • Browsers show <menu> like a bulleted list by default, so you will nearly always remove the bullets with list-style: none.
  • Screen readers announce it as a list, which helps users know how many actions there are.

HTML <menu> Tag exercises

Build a toolbar

Make a list of commands with two buttons, Copy and Paste. Use the list element meant for commands, and a button of type button in each item.

Result

Check your answer to see it here.