问题描述
我目前正在将一个页面从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:
我也可以将它们留在页脚内而不包装它们。由于页脚中的所有链接列表都是可视单元,我现在不想完全从页脚中取出外部链接,即使这在语义方面可能更好。
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:
至于< 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页脚元素内的链接(导航和旁边?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!