使用
或<页脚>标记两次?

发布于 2024-10-15 01:44:09 字数 83 浏览 5 评论 0原文

实际上允许使用标头标签两次吗?例如,我的 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 技术交流群。

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

发布评论

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

评论(6

無心 2024-10-22 01:44:09

是的,但有一个问题。 W3 文档指出,标签代表其最近祖先部分的页眉和页脚区域。我建议您拥有尽可能多的内容,但页面的每个“部分”(即正文、部分等)只能各有 1 个。

来自 W3

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

=========================

页脚元素表示其最近的祖先分段内容或分段根元素的页脚。页脚通常包含有关其部分的信息,例如编写者、相关文档的链接、版权数据等。

以下是各自标准文档的链接: 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

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.

=========================

The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.

Here are links to their respective standard documentation: header and footer

阿楠 2024-10-22 01:44:09

是的,您可以在文档中使用多个 header 元素,通过 w3c 文档的优点

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

但是请确保它在语义上是正确的。

Yes you can use multiple header elements in your documents, by virtue of the w3c documentation:

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.

However ensure that it is semantically correct.

蓝天白云 2024-10-22 01:44:09

使用两个标头标签不会有任何损失,但要确保它有意义。

There's no penalty for using two header tags, but make sure it makes sense.

暮倦 2024-10-22 01:44:09

用于标记报纸中文章的标题,因此如果您有多篇文章,则可以使用多个

这就像使用多个

。它只有在某些特殊情况下才有意义。

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.

恬淡成诗 2024-10-22 01:44:09

在某些情况下,可以像这样将两个

放在单个

/

中,那为什么呢?不是。
 <article>

      <!-- Feature Image on the LEFT -->
      <div class="position-left">
         ...featrue image...
        <header>
        ...H1 title ...  
        </header>
      </div>

      <!-- Content on the RIGHT with subtitle, date, etc -->
      <div class="position-right">
        <header>
          ..date, sub-title, etc...
        </header>
        ...content...
        <footer>..</footer>
      </div>

    </article>

In some situation, it is posible put two <header> in single <article>/<section> like this, so why not.

 <article>

      <!-- Feature Image on the LEFT -->
      <div class="position-left">
         ...featrue image...
        <header>
        ...H1 title ...  
        </header>
      </div>

      <!-- Content on the RIGHT with subtitle, date, etc -->
      <div class="position-right">
        <header>
          ..date, sub-title, etc...
        </header>
        ...content...
        <footer>..</footer>
      </div>

    </article>
胡渣熟男 2024-10-22 01:44:09

当然,您可以在文档中放置两个

标记。然而,从语义上来说,这是不正确的。为什么不使用一个

标签并在其中使用不同的标签呢?

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?

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