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!!
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With