使用或<页脚>标记两次?页脚>
实际上允许使用标头标签两次吗?例如,我的 header.php 中有两个重要的标题部分,其中两个部分都可以有标题标记。
Is it actually allowed to use the header tag twice? e.g. I have two important head-sections in my header.php where both could have header tag.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
是的,但有一个问题。 W3 文档指出,标签代表其最近祖先部分的页眉和页脚区域。我建议您拥有尽可能多的内容,但页面的每个“部分”(即正文、部分等)只能各有 1 个。
来自 W3
=========================
以下是各自标准文档的链接: header 和 页脚
Yes, but with a catch. The W3 documents state that the tags represent the header and footer areas of their nearest ancestor section. I would recommend having as many as your want, but only 1 of each for each "section" of your page, i.e. body, section etc.
From W3
=========================
Here are links to their respective standard documentation: header and footer
是的,您可以在文档中使用多个
header
元素,通过 w3c 文档的优点:但是请确保它在语义上是正确的。
Yes you can use multiple
header
elements in your documents, by virtue of the w3c documentation:However ensure that it is semantically correct.
使用两个标头标签不会有任何损失,但要确保它有意义。
There's no penalty for using two header tags, but make sure it makes sense.
用于标记报纸中文章的标题,因此如果您有多篇文章,则可以使用多个
。
这就像使用多个
。它只有在某些特殊情况下才有意义。
The
<header>
is used to mark the header of e.g. articles in newspaper, so if you have multiple articles you can use multiple<header>
.It's like using multiple
<h1>
. It does only make sense in some special case.在某些情况下,可以像这样将两个
放在单个
/
中,那为什么呢?不是。
In some situation, it is posible put two
<header>
in single<article>
/<section>
like this, so why not.当然,您可以在文档中放置两个
标记。然而,从语义上来说,这是不正确的。为什么不使用一个
标签并在其中使用不同的标签呢?
You can put two
<header>
tags in your document, sure. Semantically, however, it is incorrect. Why not use one<header>
tag and use a different tag inside it?