HTML <menu> 標籤
實例
兩個菜單按鈕系列選項實例("File" 和"Edit"):
<menu type="toolbar">
<li>
<menu label="File">
<button type="button" onclick="file_new()">New...</button>
<button type="button" onclick="file_open()">Open...</button>
<button type="button" onclick="file_save()">Save</button>
</menu>
</li>
<li>
<menu label="Edit">
<button type="button" onclick="edit_cut()">Cut</button>
<button type="button" onclick="edit_copy()">Copy</button>
<button type="button" onclick="edit_paste()">Paste</button>
</menu>
</li>
</menu>
<li>
<menu label="File">
<button type="button" onclick="file_new()">New...</button>
<button type="button" onclick="file_open()">Open...</button>
<button type="button" onclick="file_save()">Save</button>
</menu>
</li>
<li>
<menu label="Edit">
<button type="button" onclick="edit_cut()">Cut</button>
<button type="button" onclick="edit_copy()">Copy</button>
<button type="button" onclick="edit_paste()">Paste</button>
</menu>
</li>
</menu>
嘗試一下»
瀏覽器支持
目前主流瀏覽器並不支持<menu> 標籤。
標籤定義及使用說明
<menu> 標籤定義了一個命令列表或菜單。
<menu> 標籤通常用於文本菜單,工具條和命令列表選項。
提示和註釋
提示:使用CSS來定義菜單列表樣式。
HTML 4.01 與HTML5之間的差異
HTML 4.01的<menu> 元素已廢棄。
HTML5 中<menu> 元素已被重新定義。
屬性
New :HTML5新屬性。
属性 | 值 | 描述 |
---|---|---|
label New | text | 描述菜单项的标记。 |
type New | context toolbar list |
描述显示菜单类型. 默认为 "list"。 |
全局屬性
<menu>標籤支持全局屬性,查看完整屬性表HTML全局屬性 。
事件屬性
<menu>標籤支持所有HTML事件屬性 。