Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

michael Angel
michael Angel
1,213 Points

Nesting Article and Section tags...

I'm a little confused where in the video you shown, the article is nested inside the section tag, while in the MDN, the section tag is nested inside the article tag. Which should we use?

1 Answer

Steven Parker
Steven Parker
220,696 Points

The "section" tag is a generic semantic container, so there aren't many rules about how and where it can be used. The guidelines in MDN include:

  • use it for a standalone section which doesn't have a more specific semantic element to represent it
  • a <section> should be identified, typically by a heading as a child element
  • it should not be used as a purely generic container, such as for styling; this is what <div> is for
  • a section should logically appear in the outline of a document
  • it must not be a descendant of an <address> element.