Can the header tag contain more than 1 nav tag?

无人久伴 提交于 2020-01-24 01:29:24

问题


for example, I have a network nav menu at the top of the page which contains links to sites across the network and my main nav contains navigation to this site. Can both of these nav items be in the same header tag in html5? So I would have something like

<header>
   <nav id="nav_network"></nav>
   logo and stuff
   <nav id="nav_site"></nav>
</header>

Is this valid?


回答1:


This is fine by the validator:

http://validator.w3.org/check

(As long as you include a head and a title in the doc)

Usually, though, you would place the nav outside the header.

Header is more like the title, logo, and a search form.

A header element is intended to usually contain the section's heading (an h1–h6 element or an hgroup element), but this is not required. The header element can also be used to wrap a section's table of contents, a search form, or any relevant logos.

http://dev.w3.org/html5/spec/Overview.html#the-header-element

More here: http://html5doctor.com/the-header-element/




回答2:


There is nothing wrong in using Multiple nav in header, it is perfectly fine.



来源:https://stackoverflow.com/questions/7321050/can-the-header-tag-contain-more-than-1-nav-tag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!