Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it semantically valid to put an aside tag inside a header tag?

Tags:

html

As in:

<header id="mainHeader">
        <hgroup>
               <h1>Title</h1>
               <h2>Sub Title</h2>
            </hgroup>
            <aside>
                <p>Some content within the header but isn't as important.</p>
                <p>Some content within the header but isn't as important line 2.</p>
            </aside>            
    </header>

The reason for this, as demonstrated above, is that I have some content that belongs to the header (for instance, a short block of information) but is only somehow related but not really as essential as the h1 and h2 tags.

Or should I just use a normal div?

like image 531
catandmouse Avatar asked Feb 13 '12 13:02

catandmouse


1 Answers

As per HTML5 drafts, <aside> is content tangential to the main content, so this is not about importance but about topics. The <aside> element might contain shocking news, which are tangential to the boring content of a dull page.

What really matters is what other people who might look at your HTML markup think about it. The “semantics” of the new elements like <header> and <aside> has recently been characterized (by Hixie, the HTML5 editor) as mostly relating to ease of authoring and maintenance.

If you are not sure of the “semantics” yourself, the odds are that others would have difficulties with it, too. So it might be safer to use just <div class="foo"> where foo somehow characterizes the role of the content.

like image 183
Jukka K. Korpela Avatar answered Oct 04 '22 20:10

Jukka K. Korpela