Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html

How to use a menu element in HTML

Dian Us Suqlain

According to documentation, “In early versions of the HTML specification, the menu element had an additional use case as a context menu. This functionality is considered obsolete and is not in the specification.”

In this shot, we’ll learn the purpose and usage of the menu element in HTML or HyperText Markup Language.

As the name suggests, menu is suitable for toolbars, commands, and context menus. These are displayed in the form of an unordered list: <ul>.

Note: An unordered list - <ul> groups a collection of items without a numerical order.

Syntax

A menu element must have both opening (<>) and closing (</>) tags as <menu> and </menu>.

The <menu> element must include menuitem elements or li elements, similar to how <ul> includes <li> tags to display content in a menu form.

Code

To implement a <menu> tag, look at the following code snippet. The menu elements can be styled using CSSCascade Style Sheets according to user needs as shown in the code below.

<menu> tag in HTML

RELATED TAGS

html

CONTRIBUTOR

Dian Us Suqlain
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring