HTML5: How to define a list/menu of commands?
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
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics