Heading order in HTML5

▼魔方 西西 提交于 2020-01-06 02:43:31

问题


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>

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

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>

回答1:


Both variants are valid 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.

So your first example is recommended by HTML5.

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.




回答2:


Use your Second Concept it looks simple and good as per SEO.



来源:https://stackoverflow.com/questions/30608524/heading-order-in-html5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!