Menu is a list-like HTML element that browsers generally present similarly to ul. It does not magically create a working dropdown or keyboard application menu. The important question is always where the link leads and whether the person reading the page can predict it.
What You Need to Know
Buttons inside a menu still need JavaScript or another real mechanism to perform actions. Choose a list of links or buttons based on what users will do.
Links are the pathways through a website. The words on a link should help someone choose where to go before clicking it.
Example: See It in Action
Take a look at this small piece of HTML. You can use it in a practice document and change the text to make it your own.
This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.
<menu>
<li><button type="button">Save</button>
</li>
<li><button type="button">Print</button>
</li>
</menu>
<p>The buttons still need behavior to do anything.</p>
Let’s Understand the Example
- Menu represents a list of actions or items. It does not automatically make an interactive dropdown.
- Li is one item inside a list. Keep each item inside its parent list.
- Button is a real keyboard-accessible control. Inside a form, specify type when you do not want the default submit action.
- Type changes the kind of input, script, resource or button, depending on the element.
Look for the text “Save” in the page. If the visible result surprises you, inspect the rendered elements to see what the browser actually built.
What Should You See?
The page should include “Save”. If it looks different from what you expected, open developer tools and compare the source with the elements the browser created.
Imagine this link is read out of context. Would its text still explain the destination? Rename unclear links before trying to make them look nicer with CSS.
Try It Yourself
- Compare a menu of commands with a ul of navigation links.
- Save your changes, open or refresh the page, and compare the result with the original example.
- Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.
Common Beginner Mistakes
- Assuming a menu element alone makes Save or Print buttons functional.
- Avoid dead links, empty href values and clickable-looking text without a real destination.
Key Takeaways
- Menu is a list-like HTML element that browsers generally present similarly to ul.
- Menu represents a list of actions or items. It does not automatically make an interactive dropdown.
- Buttons inside a menu still need JavaScript or another real mechanism to perform actions. Choose a list of links or buttons based on what users will do.