我刚刚开始使用 HTML5 显示元素(页眉、页脚、导航等),当我在 HTML5 规范中遇到这个时,正在阅读有关导航元素的具体内容:
Not all groups of links on a page need to be in a nav element — the element is primarily intended for sections that consist of major navigation blocks. In particular, it is common for footers to have a short list of links to various pages of a site, such as the terms of service, the home page, and a copyright page. The footer element alone is sufficient for such cases; while a nav element can be used in such cases, it is usually unnecessary.
为什么特别不能在页脚中使用导航元素?通常情况下,网站似乎在页脚中有大量导航菜单(以 StackOverflow 为例,页脚中的导航比页眉中的导航更大!)
如果我在页脚中包含导航元素,我的网站是否会无法通过 HTML5 验证?或者这只是 W3C 提出的建议?
最佳答案
再读一遍,它NOT说不允许,只是说不推荐。
至于我只能推测的原因:这些新元素是出于语义原因引入的,如果您遵循此建议,您将为主要导航元素提供更多值(value)(我认为是 SEO)。
关于html - <nav> 元素在 <footer> 元素中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12368815/