<menu> …… 操作メニューを作成する
<menu>タグは、操作メニューを作成する際に使用します。サブメニューをメインメニューで入れ子にして、階層メニューにすることもできます。
<menu>は HTML 4では非推奨でしたが、HTML5ではコマンドのリストを示すという役割があり、 <command>タグとの組み合わせによるユーザーメニューの作成など、使用範囲も広がるようです。
label属性は、メニューにラベル(項目名)を付けます。 このラベルは、例えば、入れ子にされた階層メニューを、ブラウザがユーザーインターフェースとして表示する場合などに、サブメニューのラベルとして使用されます。
■HTML4.01からHTML5へのバージョンアップによる変更点
menu要素は、HTML5から新たに追加された要素です。
■属性
type属性
メニューの種類を指定する(context、toolbar)
label属性
メニューにラベル(項目名)を付ける
メニューの種類を指定する(context、toolbar)
label属性
メニューにラベル(項目名)を付ける
■使用例
HTMLソース
<menu type="toolbar">
<li>
<menu label="ファイル">
<button type="button" onclick="fnew()">新規作成</button>
<button type="button" onclick="fopen()">開く</button>
<button type="button" onclick="fsave()">上書き保存</button>
<button type="button" onclick="fsaveas()">名前を付けて保存</button>
</menu>
</li>
<li>
<menu label="編集">
<button type="button" onclick="ecopy()">コピー</button>
<button type="button" onclick="ecut()">切り取り</button>
<button type="button" onclick="epaste()">貼り付け</button>
</menu>
</li>
<li>
<menu label="ヘルプ">
<li><a href="help.html">ヘルプ</a></li>
<li><a href="about.html">このウェブサイトについて</a></li>
</menu>
</li>
</menu>
<menu type="toolbar">
<li>
<menu label="ファイル">
<button type="button" onclick="fnew()">新規作成</button>
<button type="button" onclick="fopen()">開く</button>
<button type="button" onclick="fsave()">上書き保存</button>
<button type="button" onclick="fsaveas()">名前を付けて保存</button>
</menu>
</li>
<li>
<menu label="編集">
<button type="button" onclick="ecopy()">コピー</button>
<button type="button" onclick="ecut()">切り取り</button>
<button type="button" onclick="epaste()">貼り付け</button>
</menu>
</li>
<li>
<menu label="ヘルプ">
<li><a href="help.html">ヘルプ</a></li>
<li><a href="about.html">このウェブサイトについて</a></li>
</menu>
</li>
</menu>
↓↓↓
ブラウザ上の表示