HTML5页脚元素内的链接(导航和旁边?) [英] Links inside HTML5 footer element (nav and aside?)

查看:253
本文介绍了HTML5页脚元素内的链接(导航和旁边?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在将一个页面从HTML4移动到HTML5,我有一个问题。页脚中有一堆链接列表。他们中的大多数链接到关于网站本身的信息(常见问题等)。所以我认为把它们放在一个nav元素中是可以的(参见HTML5简介和HTHML5 Doctor)。但是两个列表包含指向Facebook等外部页面的链接。现在我可以把它们放在一边,但这有点边缘:

I'm currently moving a page from HTML4 to HTML5, and I have kind of an issue. There's a bunch of lists with links inside the footer. Most of them link to information (faq etc.) about the site itself. So I think it's OK to put those inside a nav element (see "Introducing HTML5" and the HTHML5 Doctor). But two lists contain links to external pages like Facebook. Now I could wrap those inside an aside, but this is a bit of an edge case:


包装链接是合法的网站上的其他页面在页脚内部 - 但是问问自己是否要将其作为页脚的兄弟[...]毕竟,与其他页面的链接可能与整个页面相关而不仅仅是页脚的内容。 (HTML5简介)

"It is legitimate to wrap the links to other pages on the site with an aside inside the footer — but ask yourself whether the aside to instead be a sibling of the footer [...] After all, the links to other pages are presumably tangentially related to the whole page rather than just the content of the footer." (Introducing HTML5)

我也可以将它们留在页脚内而不包装它们。由于页脚中的所有链接列表都是可视单元,我现在不想完全从页脚中取出外部链接,即使这在语义方面可能更好。

I could also just leave them inside the footer without wrapping them. Since all the lists of links in the footer are a "visual unit", I wouldn't wanna take the external links out of the footer altogether at the moment, even though that might be better in regards to semantics.

我正在搜索具有类似页脚的HTML5网站但找不到任何内容。

I was searching for HTML5 sites with a similar footer but couldn't find any.

你们认为最好的方法是什么?

What do you guys think is the best approach?

谢谢

推荐答案

我建议只使用带有链接的< footer>

I would suggest simply using a <footer> with links in it.

如果您想将链接包装在< nav> 中,这是可以接受的,但我会建议不要这样做。 < nav> 元素用于标记主要导航块,并且您将链接放在页脚中的事实表明它们不是主要的导航块。 (从某种意义上说,< footer> < nav> 几乎是矛盾的。)规格甚至具体谈论这个场景:

If you want to wrap the links in a <nav>, that’s acceptable, but I would advise against it. The <nav> element is intended to mark up "major" navigation blocks, and the fact that you’re putting the links in a footer suggests that they are not a major navigation block. (In a sense, <footer> and <nav> are almost contradictory.) The spec even talks specifically about this scenario:


并非页面上的所有链接组都必须位于nav元素中 - 该元素主要用于包含主要导航块的部分。特别是,页脚通常会有一个指向网站各个页面的链接的简短列表,例如服务条款,主页和版权页面。 单独的页脚元素足以满足此类情况;虽然在这种情况下可以使用nav元素,但通常是不必要的。

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.

至于< aside> ; ,如果你只想在其中添加一些链接,我会说这太过分了,特别是因为它听起来像是外部的,它们与其他链接一起属于。如果它有助于造型,并且外部链接感觉像是一个独立的单元,那么肯定 - 否则,不要打扰。我会说< footer> 元素本身已经带有足够的旁白语义。

As for <aside>, I would say it’s overkill if you’re only going to put a few links in it, especially since it sounds like, though external, they belong together with the other links. If it helps with styling, and the external links feel like kind of a self-contained unit, then sure—otherwise, don’t bother. I would say the <footer> element itself already carries enough aside-ish semantics.

这篇关于HTML5页脚元素内的链接(导航和旁边?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆