我可以使用< nav>标签以获取文章标签列表? [英] Can I use <nav> tag for list of article tags?
问题描述
文章之后,我有与文章相关的标签列表.将这些标签的列表包装在<nav>
html标签中在语义上是否正确?如果没有,那是什么合适的呢?
After the article I have list of tags related to article. Is it semantically correct to wrap list of those tags in <nav>
html tag? If no, what would be the proper one?
<nav class="tags">
Tags:
<ul>
<li><a href="#">Tag1</a></li>
<li><a href="#">Tag2</a></li>
<li><a href="#">Tag3</a></li>
</ul>
</nav>
- 并非文档的所有链接都必须在
<nav>
元素中,即 仅用于主要的导航链接;通常是<footer>
元素通常具有不需要在链接中的链接列表.<nav>
元素. - 用户代理(例如针对残疾用户的屏幕阅读器)可以 使用此元素来确定是否省略首字母 呈现此内容.
- Not all links of a document must be in a
<nav>
element, which is intended only for major block of navigation links; typically the<footer>
element often has a list of links that don't need to be in a<nav>
element. - User agents, such as screen readers targeting disabled users, can use this element to determine whether to omit the initial rendering of this content.
推荐答案
标记是文章元数据的一部分(就像作者姓名,出版日期等一样),因此标记应位于 footer
元素,并且此footer
应该在article
元素内:
The tags are part of the article’s metadata (just like the author name, the publication date, etc.), so they should be in a footer
element, and this footer
should be inside the article
element:
<article>
<footer><!-- tags --></footer>
</article>
(某些人可能会使用 header
而不是footer
,但是它的默认角色banner
确实不合适,并且不能具有contentinfo
角色
(Some might use header
instead of footer
, but its default role banner
is not really appropriate, and it can’t have the contentinfo
role, which would be appropriate.)
对于这样一个简单的标签列表,实际上并不需要另一个section元素.
For such a simple list of tags, another sectioning element isn’t really needed.
相关:我对标签的语义标记的回答.
这篇关于我可以使用< nav>标签以获取文章标签列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!