[ANSWERED] Main - Article - Section - Sub-Section

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
Post Reply
paulp575
Rank IV - Intermediate
Posts: 170
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

[ANSWERED] Main - Article - Section - Sub-Section

Post by paulp575 »

Using HTML 5:

I know the hierarchy - Main - Article - Section, but what if I need to create sections (parts that can stand alone) with a section?

Should I close a section and then start a new section? Or can I use a section within a section>
Last edited by paulp575 on Tue Aug 17, 2021 3:27 pm, edited 1 time in total.
paulp575
User avatar
Albert Wiersch
Site Admin
Posts: 3783
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Main - Article - Section - Sub-Section>

Post by Albert Wiersch »

Hi Paul,

Here is a good documentation page on the HTML5 "section" element:
https://developer.mozilla.org/en-US/doc ... nt/section
The <section> HTML element represents a generic standalone section of a document, which doesn't have a more specific semantic element to represent it. Sections should always have a heading, with very few exceptions.
I am not sure there is a "right" answer to your question.

If there is content that can stand alone, then I would not nest it in "section" elements. If the content in question is related to the content in a section element, then it may be better to nest such content in an "aside" element in the "section". Otherwise if you have multiple different pieces of content that can stand alone from the "main" content then I would think it would be best to have multiple "section" elements that are not nested within each other. .. UPDATE: BUT... if some of that standalone content is related to another piece of standalone content, then the related pieces of standalone content might be best off if they were in the same sectioning element like a "section"... so... it seems rather complicated depending on how the pieces of content relate to the main content and to the other pieces of content.

I hope this makes sense. Without seeing all the details it's hard to answer the question, plus I can only offer my opinion based on the information in the document I linked to above... and there may not be one "right" answer to the question. I hope this still helps. :)
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
paulp575
Rank IV - Intermediate
Posts: 170
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

Re: Main - Article - Section - Sub-Section>

Post by paulp575 »

Appreciate the answer.
I guess I'll maybe use the <div> in this case.
paulp575
Post Reply