Brandon
Brandon

Reputation: 3146

HTML5 section headings

Say I have a section of content on my page, i.e.:

Heading 1
Some content

What would be the best way to represent this using HTML5?

<section>
    <header>
        <h1>Heading 1</h1>
    </header>
    <p>Some content</p>
</section>

Or would it be:

<section>
    <h1>Heading 1</h1>
    <p>Some content</p>
</section>

I guess I'm a bit confused whether the header tag is required here or if it's superfluous. I've been reading the specifications and I haven't seen anything address this.

Upvotes: 0

Views: 703

Answers (1)

Joseph
Joseph

Reputation: 119877

the <header> was made to replace the traditional <div id="header"> - the usual place for banners, logos and stuff above the website..

in your case, your "header" is more of a title for the following content. a heading+paragraph pair is suitable for that.

<section>
    <h1>Heading 1</h1>
    <p>Some content</p>
</section>

Upvotes: 3

Related Questions