开发者

Right HTML 5 Article Structure

开发者 https://www.devze.com 2023-04-13 01:58 出处:网络
I hope the question is not too generic, but I would need an advice: Which one of the following examples would you consider to be the right one?

I hope the question is not too generic, but I would need an advice:

Which one of the following examples would you consider to be the right one?

Number 1

<article>
    <section>
        <header>
            <h1>Title</h1>
        </header>
        <p>Content</p>

        <h2>Title 2</h2>
        <p>Content</p>

        <footer>
            <p>footer</p>
    开发者_开发百科    </footer>
    </section>
</article>

Number 2

<article>
    <section>
        <header>
            <h1>Title</h1>
        </header>
        <p>Content</p>

        <header>
            <h2>Title 2</h2>
        </header>
        <p>Content</p>

        <footer>
            <p>footer</p>
        </footer>
    </section>
</article>

Number 3

<article>
    <section>
        <header>
            <h1>Title</h1>
        </header>
        <p>Content</p>
        <footer>
            <p>footer</p>
        </footer>
    </section>
    <section>
        <header>
            <h2>Title</h2>
        </header>
        <p>Content</p>
        <footer>
            <p>footer</p>
        </footer>
    </section>
</article>

I would prefer example number 1, but I am not totally sure :/


1 and 2 are equivalent. Use whichever you prefer. The implicit section started by the <h2> is inside the explicit section.

3 is semantically different. The <h2> in the second section has the same ranking as <h1> in the first section, and the two sections are peers.

0

精彩评论

暂无评论...
验证码 换一张
取 消