gpt4 book ai didi

html - 网站标题和其他次要部分的标题使用哪个标签

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:37:03 24 4
gpt4 key购买 nike

考虑到SEO语义文档大纲,哪些标签适合(或最常用)网站标题和其他次要部分的标题(例如侧边栏、相关链接)?

示例文档:

<header>
<h1>I'm Site Name, not the title of actual article</h1>
</header>

<aside>
<h1>And I'm sidebar heading, ain't about the article of this page either</h1>
</aside>

<article>
<h1>I'm the title of article, supposed to be what this page is all about</h1>

<p>intro...<p>

<h2>Subhead. Make site name and section heading a h2 tag, and I'm equal to them.</h2>
<p>text of about the subhead...</p>
</article>

这是我想到的 3 条准则:

准则 1:无人能及的方式

  • strong 网站标题和章节标题上的标签。

准则 2:网站标题 = 文章的副主题

    网站标题上的
  • h2 标签;和
  • h3 章节标题上的标签

准则 3:只使用一种标题标签

  • 网站标题和版 block 标题的任何标题标签(很可能是 h2、h3 或 h4)。

最佳答案

要么对每个部分使用 h1(如示例代码段),要么使用适当级别的标题元素(对应于部分的嵌套级别)。

两种方式都有自己的pros and cons , 但 HTML5 规范鼓励作者使用后一种方式 ( probably because of old or non-conforming user agents )。

按照该建议,您的代码段将是:

<header>
<h1>Site name</h1>
</header>

<aside>
<h2>Aside title</h2>
</aside>

<article>
<h2>Article title</h2>

<section>
<h3>Subhead</h3>
</section>

</article>

请注意,我为“副标题”标题开始的隐式部分添加了一个 section 元素。这是 encouraged by HTML5, too .

关于html - 网站标题和其他次要部分的标题使用哪个标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36123417/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com