In another conversation, it was brought up that <nav> adds useless code, like this:
<nav>
<ul>
<li>Link</li>
</ul>
</nav>
To me that does seem pointless. But the HTML5 spec does say that the element does not have to contain a list and they provide this example:
If that is the case, would this mean that it is possible to write the navigation this way:A nav element doesn't have to contain a list, it can contain other kinds of content as well. In this navigation block, links are provided in prose:
Code HTML5:<nav> <h1>Navigation</h1> <p>You are on my home page. To the north lies <a href="/blog">my blog</a>, from whence the sounds of battle can be heard. To the east you can see a large mountain, upon which many <a href="/school">school papers</a> are littered. Far up thus mountain you can spy a little figure who appears to be me, desperately scribbling a <a href="/school/thesis">thesis</a>.</p> <p>To the west are several exits. One fun-looking exit is labeled <a href="http://games.example.com/">"games"</a>. Another more boring-looking exit is labeled <a href="http://isp.example.net/">ISP™</a>.</p> <p>To the south lies a dark and dank <a href="/about">contacts page</a>. Cobwebs cover its disused entrance, and at one point you see a rat run quickly out of the page.</p> </nav>
<nav>
<a href....>
<a href....>
<a href....>
</nav>
Then, target <nav> as you would targeted <ul>, and target the internal <a> as you would <li>. Personally, though, I like having the three targets of <ul>, <li> and <a>, whereas the above reduces that by one, and the previous adds one unnecessary. But would the above cause any unexpected problems?



Reply With Quote








Bookmarks