Is it correct to use the <menu> tag as navigation?
Like that:
<menu>
<li><a href="#">Home</a></li>
<li><a href="#">Page one</a></li>
<li><a href="#">Page two</a></li>
<li><a href="#">Page three</a></li>
</menu>
Or is it indicated only for a Context menu, like the example on Mozilla?
2
Answers
If you’re asking if it would work then it absolutely works.
But if you’re asking me would i recomend it?
Absolutely not.
Hope it clarifies your doubt.
Thank You!
In your exmaple you are using the
<menu>
tag correctly and as matter of fact that is the way you should actually code a navigation list.The
<menu>
tag is a sementic alternative to the unsemantic<ul>
as is treated by the browser as the same.To quote MDN WebDocs:
<a>
nchors are interactive elements and as such the<menu>
should be correctly used as a list container in that case.However, your wording is incorrect.
<menu>
is only a container for the unordered list of anchors but not an entire navigation for which the<nav>
element should be used.As example a navigation bar could contain more then just links: