Search code examples
htmlsemantics

In HTML5, is placing a login/logout link in a nav tag semantically correct


I have the following navigation HTML mark-up:

<nav>
 <ul>
     <li>Home</li>
     <li>Contact us</li>
     <li>Login</li>
 </ul>
</nav>

In the HTML 5 documentation explains nav tag as “major navigation” links. I'm not quite sure having login link in nav tag is semantically correct and if login/logout is considered as a major navigation?

Any opinions?


Solution

  • You can determine all by yourself what a major nav link is. You have to see it like this: Your Major Navigation links are the links that are important for the people who are using your website, including yourself of course. So if you think it will be good to have a quick login link somewhere on your nav, then Yes, Login should be in your nav.

    Nobody is gonna check if your nav is correct, and nobody is gonna blame you for putting a login link in your nav.