MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

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

사용 알림: <menu><ul> 요소 둘 다 무순의 아이템 목록을 말합니다. 가장 중요한 차이점은 <ul>는 주로 보여주는 아이템을 담지만, <menu>는 실행할 수 있는 상호작용 가능한 아이템을 의미한다는 것입니다.

알림: 이 요소는 HTML4에 사장되었지만, HTML5.1(아직 초안 단계)에 재정의되었습니다. 이 문서는 현재 파이어폭스에 구현된 것을 설명합니다. HTML5.1 초안에 의하면 type 속성값의  'list'는 'toolbar'로, 'context'는 'popup'으로 바뀔 것 같습니다.

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 <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 <li>, <script>, and <template>.
If the element is in the context menu state: zero or more occurrences, in any order, of <menu> (context menu state only), <menuitem>, <hr>, <script>, and <template>.
Tag omission None, both the starting and ending tag are mandatory.
Permitted parent elements Any element that accepts flow content.
DOM interface HTMLMenuElement

속성

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

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 <menu> in the context menu state.
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 menu attribute of a <button>, or an element with a contextmenu attribute. When nesting <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 <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

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

스펙

Specification Status Comment
WHATWG HTML Living Standard
The definition of '<menu>' in that specification.
Living Standard  
HTML5.1
The definition of '<menu>' in that specification.
Working Draft Initial definition

브라우저

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? Not supported[1] ? ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? Not supported[1] ? ? ?

[1] Gecko has some implementation, though it is not compatible to the specification. See bug 1100749.

See also

문서 태그 및 공헌자

 이 페이지의 공헌자: Kaben
 최종 변경: Kaben,