--- title: slug: Web/HTML/Element/menu translation_of: Web/HTML/Element/menu ---
{{HTMLRef}}{{SeeCompatTable}}

HTML <menu> 요소는 사용자가 수행하거나 하는 명령 묶음을 말합니다. 이것은 스크린 위에 나오는 목록 메뉴와 눌려진 버튼 아래에 나오는 것과 같은 맥락 메뉴를 포함합니다.

Content categories Flow content. Additionally, if in the list menu state, palpable content. (list menu is the default state, unless the parent element is a {{HTMLElement("menu")}} in the context menu state.)
Permitted content If the element is in the list menu state: flow content, or alternatively, zero or more occurrences of {{HTMLElement("li")}}, {{HTMLElement("script")}}, and {{HTMLElement("template")}}.
If the element is in the context menu state: zero or more occurrences, in any order, of {{HTMLElement("menu")}} (context menu state only), {{HTMLElement("menuitem")}}, {{HTMLElement("hr")}}, {{HTMLElement("script")}}, and {{HTMLElement("template")}}.
Tag omission {{no_tag_omission}}
Permitted parent elements Any element that accepts flow content.
DOM interface {{domxref("HTMLMenuElement")}}

속성

이 요소는 전역 속성을 포함합니다.

{{htmlattrdef("label")}}
사용자에게 보여지는 메뉴의 이름입니다. Used within nested menus, to provide a label through which the submenu can be accessed. Must only be specified when the parent element is a {{HTMLElement("menu")}} in the context menu state.
{{htmlattrdef("type")}}
This attribute indicates the kind of menu being declared, and can be one of two values.
  • context: The context menu state, which represents a group of commands activated through another element. This might be through the {{htmlattrxref("menu", "button")}} attribute of a {{HTMLElement("button")}}, or an element with a contextmenu attribute. When nesting {{HTMLElement("menu")}} elements directly within one another, this is the missing value default if the parent is already in this state.
  • list: The list menu state, which represents a series of commands for user interaction. This is the missing value default, except where the parent element is a {{HTMLElement("menu")}} in the context menu state.

Examples

Example 1

<!-- A button, which displays a menu when clicked. -->
<button type="menu" menu="dropdown-menu">
  Dropdown
</button>

<menu type="context" id="dropdown-menu">
  <menuitem label="Action">
  <menuitem label="Another action">
  <hr>
  <menuitem label="Separated action">
</menu>

Result

{{EmbedLiveSample('Example_1')}}

Example 2

<!-- A context menu for a simple editor, containing two menu buttons. -->
<menu>
  <li>
    <button type="menu" value="File" menu="file-menu">
    <menu type="context" id="file-menu">
      <menuitem label="New..." onclick="newFile()">
      <menuitem label="Save..." onclick="saveFile()">
    </menu>
  </li>
  <li>
    <button type="menu" value="Edit" menu="edit-menu">
    <menu type="context" id="edit-menu">
      <menuitem label="Cut..." onclick="cutEdit()">
      <menuitem label="Copy..." onclick="copyEdit()">
      <menuitem label="Paste..." onclick="pasteEdit()">
    </menu>
  </li>
</menu>

Result

{{EmbedLiveSample('Example_2')}}

명세

Specification Status Comment
{{SpecName('HTML WHATWG', 'interactive-elements.html#the-menu-element', '<menu>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5.1', 'interactive-elements.html#the-menu-element', '<menu>')}} {{Spec2('HTML5.1')}} Initial definition

브라우저 호환성

{{Compat("html.elements.menu")}}

같이 보기