Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it ok to have section tag within footer tag in HTML5?

Tags:

html

I'm new to HTML5 markup.

I'm wondering if I'm allowed to have a section tag within footer like the below.

<article>
    <header class="content__header">
    </header>

    <section class="content__body">
    </section>

    <footer class="content__footer>
        <section class="relatedArticles">
        </section>
        <section class="pagination">
        </section>
    </footer>

</article>

The w3c document doesn't explain much about footer tag usage.

Thanks!!

like image 394
W3Q Avatar asked Sep 20 '14 04:09

W3Q


People also ask

Can you put a section in a footer HTML?

Sectioning elements can be nested inside one another as many times as is needed based on the content. The header and footer in a sectioning element can also contain sectioning elements.

Should footer tag be inside body tag?

The <footer> tag in HTML is used to define a footer of HTML document. This section contains the footer information (author information, copyright information, carriers, etc). The footer tag is used within the body tag.

Can you use section tag inside?

Nested Section tag: The section tag can be nested. The font size of subsection is smaller then section tag if the text contains the same font property. The subsection tag is used for organizing complex documents. A rule of thumb is that section should logically appear in outline of the document.

Where do you put section tags in HTML?

The <section> tag can be nested within the <article> tag, dividing the content into groups. Therefore, it is required to use <h1> -<h6> headings within the <article> and the <section> tags. It is allowed to use <h2> title in each section, defined with the <section> tag.


1 Answers

The w3c document doesn't explain much about footer tag usage.

...actually, it does. Section 4.3.8 <footer> ( http://www.w3.org/TR/html5/sections.html#the-footer-element ) states:

Content model: Flow content, but with no header, footer, or main element descendants.

The section of the specifiction defining "Flow content" (3.2.4.1.2) lists all "flow" elements, which lists <section>.

So therefore, your HTML is valid: <section> can be a descendant of <footer>, however <header>, <footer>, and <main> cannot.

like image 188
Dai Avatar answered Oct 25 '22 14:10

Dai