gpt4 book ai didi

html - HTML5 中的标题顺序

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

这是我网站的网页示例:

<html>

<title> artilce header </title>

<body>
<header> <h1> nme of website</h1></header>

<section>
<h2> name of section</h2>

<article>
<h3>article header</h3>

</article>
</section>
</body>
</html>

我想知道这个顺序是否正确?或者它可能对 SEO 产生不良影响?

header 在所有页面中,section 必须有header 因为header/...

例如,我是否必须将其更改为这样的内容:

<html>

<title> artilce header </title>

<body>
<header> <h2> nme of website</h2></header>

<section>
<h3> name of section</h3>

<article>
<h1>article header</h1>

</article>
</section>
</body>
</html>

最佳答案

两种变体都是有效的 HTML5。

HTML5 规范说明了 headings and sections :

Sections may contain headings of any rank, and authors are strongly encouraged to use headings of the appropriate rank for the section's nesting level.

所以你的第一个例子是 HTML5 推荐的。

HTML5 does not定义 h1h6 更“重要”。
消费者(如搜索引擎)如何解释这取决于他们,并且很可能因消费者而异,因此您必须检查他们的文档。

关于html - HTML5 中的标题顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30608524/

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