Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5: Should I use h2's or h3's for content inside of an aside element?

I've been poking around online but I can't seem to find a definitive answer on this. Given the following HTML5 structure below, should I be using h2's or h3's inside of my aside element for content titles?

I know it's okay to use multiple h1's as long as they are inside a section and/or article element. But i'm not sure what I should do within my aside? I think I should stay away from multiple h1's in an aside but im not sure about h2's and h3's.

Thanks!

<!DOCTYPE html>
<html>
<head>
<title>Heading Tags</title>
</head>
<body>
<section>
    <header>
        <h1>Main Section</h1>
    </header>

    <article>
        <h1>Article Title 1</h1>
        <div>Some Content Here</div>
    </article>

    <article>
        <h1>Article Title 2</h1>
        <div>Some Content Here</div>
    </article>

    <article>
        <h1>Article Title 3</h1>
        <div>Some Content Here</div>
    </article>
</section>

<aside>
    <header>
        <h1>Side Bar Heading</h1>
    </header>

    <div>
        <h2>Side Content Title 1</h2>
        <div>Some Content Here</div>
    </div>

    <div>
        <h2>Side Content Title 2</h2>
        <div>Some Content Here</div>
    </div>

    <div>
        <h2>Side Content Title 3</h2>
        <div>Some Content Here</div>
    </div>
</aside>
</body>
</html>
like image 281
Maddhacker24 Avatar asked Feb 13 '13 17:02

Maddhacker24


People also ask

Which type of content should use an aside?

The <aside> element is used to identify content that is related to the primary content of the webpage, but does not constitute the primary content of the page. Author information, related links, related content, and advertisements are exampes of content that may be found in an aside element.

What should you use the aside element in HTML?

The element can be used for typographical effects like pull quotes or sidebars, for advertising, for groups of nav elements, and for other content that is considered separate from the main content of the page.

Should Aside be inside main?

Following the newer definition, the aside element should be inside of the section element to which it is related. The main element is not a sectioning element (elements like article , section , body , figure etc. are).

When should you use the aside tag element?

The <aside> tag defines some content aside from the content it is placed in. The aside content should be indirectly related to the surrounding content. Tip: The <aside> content is often placed as a sidebar in a document. Note: The <aside> element does not render as anything special in a browser.


1 Answers

According to MDN:

Sections in HTML5 can be nested. Beside the main section, defined by the element, section limits are defined either explicitly or implicitly. Explicitly-defined sections are the content within <body>, <section>, <article>, <aside>, and <nav> tags.

Each section can have its own heading hierarchy. Therefore, even a nested section can have an <h1>.

So the way you've done it -- with one <h1> and multiple <h2> inside your <aside> -- is appropriate.

like image 199
Luke Avatar answered Oct 16 '22 11:10

Luke