Forum Moderators: open
<section>
<header>
<h1>Text here</h1>
<p>anything else needed</p>
<p>Few words to describe what body text is about</p>
</header>
<p>Several sentences about both topics</p>
<p>Several sentences about both topics</p>
<p>Several sentences about both topics</p>
<section>
<h2>Text about anaerobic exercise</h2>
<ul>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
</ul>
</section>
<section>
<h2>Text about aerobic exercise</h2>
<ul>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
</ul>
</section>
<footer>
<p>Text including link to another page</p>
<p>anything else needed</p>
</footer>
</section>
Would this footer go in a separate <footer> tag after the <footer> tag in your example?
Mostly the real answer is "it depends on author intent".
The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.
How I wrote it above the footer goes with the outer section (as does the header).
the footer might logically and content-wise belong with the 2nd <h2> section, in which case it should move in there.
The footer might also belong to a more global scope than this outer section, in which case it should be moved outside of it.
<section>
<header>
<h1>Text here</h1>
<p>anything else needed</p>
<p>Few words to describe what body text is about</p>
</header>
<p>Several sentences about both topics</p>
<p>Several sentences about both topics</p>
<p>Several sentences about both topics</p>
<section>
<h2>Text about anaerobic exercise</h2>
<ul>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
</ul>
</section>
<section>
<h2>Text about aerobic exercise</h2>
<ul>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
</ul>
</section>
<footer>
<p>Text including link to another page</p>
<p>anything else needed</p>
</footer>
</section>
Headings never rise above other sections. Thus, in the following example, the first h1 does not actually describe the page header; it describes the header for the second half of the page:
<!DOCTYPE HTML>
<title>Feathers on The Site of Encyclopedic Knowledge</title>
<section>
<h1>A plea from our caretakers</h1>
<p>Please, we beg of you, send help! We're stuck in the server room!</p>
</section>
<h1>Feathers</h1>
<p>Epidermal growths.</p>
The resulting outline would be:
-- (untitled page)
---- A plea from our caretakers
-- Feathers
For the following fragment:
<body>
<h1>Foo</h1>
<h2>Bar</h2>
<blockquote>
<h3>Bla</h3>
</blockquote>
<p>Baz</p>
<h2>Quux</h2>
<section>
<h3>Thud</h3>
</section>
<p>Grunt</p>
</body>
...the structure would be:
-- Foo (heading of explicit body section, containing the "Grunt" paragraph)
Bar (heading starting implied section, containing a block quote and the ---- "Baz" paragraph)
---- Quux (heading starting implied section with no content other than the heading itself)
---- Thud (heading of explicit section section)
Notice how the section ends the earlier implicit section so that a later paragraph ("Grunt") is back at the top level.
<section>
<footer>
<ul>
<li>Some information here</li>
<li>Some more information here</li>
</ul>
<p>A sentence here</p>
</footer>
</section>
a <footer> can belong either to the page-as-a-whole or to a section, hence the business about immediate ancestors (much like <address> in this respect)
Have I got that right?
<header>Text here</header>
<h1>Text here</h1>
<p>Few words to describe what body text is about</p>
<p>Several sentences about both topics</p>
<p>Several sentences about both topics</p>
<p>Several sentences about both topics</p>
<h2>Text about anaerobic exercise</h2>
<ul>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
</ul>
<h2>Text about aerobic exercise</h2>
<ul>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
<li>Several sentence bullet point.</li>
</ul>
<p>Text including link to another page</p>
<footer>Text here</footer>
<body>
- <header>
-- <p>Text here</p>
-- <h1>Text here</h1>
-- <p>Few words to describe what body text is about</p>
- </header>
- <p>Several sentences about both topics</p>
- <p>Several sentences about both topics</p>
- <p>Several sentences about both topics</p>
-- <section>
--- <h2>Text about anaerobic exercise</h2>
--- <ul>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
--- </ul>
-- </section>
-- <section>
--- <h2>Text about aerobic exercise</h2>
--- <ul>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
--- </ul>
-- <section>
-- <aside>
--- <p>Text including link to another page</p>
-- <aside>
- <footer>Text here</footer>
</body>
For example, the following is correct:
<body>
- <h4>Apples</h4>
- <p>Apples are fruit.</p>
- <section>
-- <h2>Taste</h2>
-- <p>They taste lovely.</p>
-- <h6>Sweet</h6>
-- <p>Red apples are sweeter than green ones.</p>
-- <h1>Color</h1>
-- <p>Apples come in various colors.</p>
- </section>
</body>
However, the same document would be more clearly expressed as:
<body>
- <h1>Apples</h1>
- <p>Apples are fruit.</p>
- <section>
-- <h2>Taste</h2>
-- <p>They taste lovely.</p>
-- <section>
--- <h3>Sweet</h3>
--- <p>Red apples are sweeter than green ones.</p>
-- </section>
- </section>
- <section>
-- <h2>Color</h2>
-- <p>Apples come in various colors.</p>
- </section>
</body>
Both of the documents above are semantically identical and would produce the same outline in compliant user agents.
This third example is also semantically identical, and might be easier to maintain (e.g. if sections are often moved around in editing):
<body>
- <h1>Apples</h1>
- <p>Apples are fruit.</p>
- <section>
-- <h1>Taste</h1>
-- <p>They taste lovely.</p>
-- <section>
--- <h1>Sweet</h1>
--- <p>Red apples are sweeter than green ones.</p>
-- </section>
- </section>
- <section>
-- <h1>Color</h1>
-- <p>Apples come in various colors.</p>
- </section>
</body>
I think that you are saying that only the h2 tag and the content below it that is related to the h2 tag should be put in a <section> tag?
You got it! -- In the example you gave that's all you need to use <section> for.
<body>
- <header>
-- <p>Text here</p>
-- <h1>Text here</h1>
-- <p>Few words to describe what body text is about</p>
- </header>
- <p>Several sentences about both topics</p>
- <p>Several sentences about both topics</p>
- <p>Several sentences about both topics</p>
-- <section>
--- <h2>Text about anaerobic exercise</h2>
--- <ul>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
--- </ul>
-- </section>
-- <section>
--- <h2>Text about aerobic exercise</h2>
--- <ul>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
--- </ul>
-- <section>
-- <aside>
--- <p>Text including link to another page</p>
-- <aside>
- <footer>Text here</footer>
</body>
<body>
- <header>
-- <p>Text here</p>
-- <h1>Text here</h1>
-- <p>Few words to describe what body text is about</p>
- </header>
- <p>Several sentences about both topics</p>
- <p>Several sentences about both topics</p>
- <p>Several sentences about both topics</p>
-- <section>
--- <h2>Text about anaerobic exercise</h2>
--- <ul>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
--- </ul>
-- </section>
-- <section>
--- <h2>Text about aerobic exercise</h2>
--- <ul>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
---- <li>Several sentence bullet point.</li>
--- </ul>
-- <section>
- <p>Text including link to another page</p>
- <footer>Text here</footer>
</body>
What is the BENEFIT of using <section>?
- <header>
-- <p>Text here</p>
-- <h1>Text here</h1>
-- <p>Few words to describe what body text is about</p>
- </header>
- <p>Several sentences about both topics</p>
- <p>Several sentences about both topics</p>
- <p>Several sentences about both topics</p>
-- <section>
<header>
-- <p>Text here</p>
-- <h1>Text here</h1>
-- <p>Few words to describe what body text is about</p>
- </header>
do you think that I need to put the title within <p> tags if I use <header>?
div#something div#otherthing ul li ul li .special ul li.foobar p {some-style-here} One thing I would likely do differently though is rather than putting the title in the header section, which would be repeating it, I would put the <p>Few words to describe what body text is about</p> in the header as a "lede" rather than under the H1.