w3resource

HTML5: How to define a list/menu of commands?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Declares the document type and version of HTML -->
<html><!-- Begins the HTML document -->
<head><!-- Contains metadata about the document -->
<meta charset="utf-8"><!-- Specifies the character encoding for the document -->
<title>How to define a list/menu of commands</title><!-- Sets the title of the document -->
</head><!-- Ends the head section -->
<body><!-- Contains the content of the document -->
<menu><!-- Defines a list/menu of commands -->
<li>HTML Lists. </li><!-- Represents a list item -->
<li>HTML Unordered Lists.</li><!-- Represents another list item -->
<li>HTML Ordered Lists.</li><!-- Represents another list item -->
<li>HTML Definition Lists.</li><!-- Represents another list item -->
</menu><!-- Ends the menu of commands -->
</body><!-- Ends the body section -->
</html><!-- Ends the HTML document -->

Explanation:

  • The HTML document begins with a declaration of its type and version (<!DOCTYPE html>).
  • The <html> element encloses the entire HTML document.
  • The <head> section contains metadata about the document, including the character encoding and the title.
  • Inside the <body> section, a <menu> element is used to define a list or menu of commands.
  • Each <li> element represents a command within the menu, forming a list of items.
  • The text within each <li> element represents the command or item in the menu.

Live Demo:

See the Pen menu-answer by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
Yes Yes Yes Yes Yes

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.