标题标签可以包含超过 1 个导航标签吗?

发布于 2024-12-03 02:18:57 字数 272 浏览 0 评论 0原文

例如,我在页面顶部有一个网络导航菜单,其中包含指向整个网络站点的链接,而我的主导航包含指向该站点的导航。这两个导航项可以位于 html5 中的同一标头标记中吗?所以我会有这样的东西,

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

这有效吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

懷念過去 2024-12-10 02:18:57

验证器可以这样做:

http://validator.w3.org/check

(只要您在文档中包含 headtitle

但通常情况下,您会将 nav 放在 header 之外。

Header 更像是标题、徽标和搜索表单。

标题元素通常包含该部分的标题
(h1–h6 元素或 hgroup 元素),但这不是必需的。这
header 元素还可以用于包装节的目录,
搜索表单或任何相关徽标。

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

更多信息:http://html5doctor.com/the -标题元素/

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/

断桥再见 2024-12-10 02:18:57

在标题中使用多个导航没有任何问题,它完美没问题。

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

从来不烧饼 2024-12-10 02:18:57

是的,您可以插入多个元素;如果您基本上是在询问可用性,那么这就是答案。您可以使用多个元素,浏览器将完美地读取您的代码,因为该元素在浏览器中被读取为一个元素,并且它们之间没有区别。

但从搜索引擎优化的角度来看,不建议这样做,因为它会告诉搜索引擎在哪里可以找到您的导航菜单。因此,您的网站上应该只使用一个导航栏。

简而言之,您可以这样做,但不建议这样做。

Yes, you can insert more than one element; that is the answer if you are basically asking about the availability. You can use more than one element, and the browser will read your code perfectly since the element is read as a element in your browser, and there is no difference between them.

But as an SEO wise it is not recommended because the is telling search engines where they can find your navigation menu. So, it is supposed to use only one navigation bar on your website.

Briefly, you can do that, but it is not recommended.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文