HTML5 中的标题顺序 [英] Heading order in HTML5

查看:23
本文介绍了HTML5 中的标题顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我网站的网页示例:

This is a webpage example of my site:

<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 产生不良影响?

I want to know if this order is correct? Or does it maybe have a bad effect on SEO?

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

header is in all pages, section must have an header because of header/…

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

For example, do I I have to change it to something like this:

<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.

Both variants are valid HTML5.

HTML5 规范说明了 标题和部分:

The HTML5 spec says about 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 推荐的.

So your first example is recommended by HTML5.

HTML5 没有定义 h1 更重要"h6.
消费者(如搜索引擎)如何解释这取决于他们自己,而且很可能因消费者而异,因此您必须查看他们的文档.

HTML5 does not define that h1 would be more "important" than h6.
How consumers (like search engines) interpret this is up to them and it most likely differs from consumer to consumer, so you’d have to check their documentation.

这篇关于HTML5 中的标题顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆