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

Steven Nava
PLUS
Steven Nava
Courses Plus Student 5,144 Points

Is it okay for the aside to go inside of main?

In the previous modules and practices aside was moved outside of main. In fact, in the previous practice, the editor had me remove it from main. Is it okay for it to go inside of main or is it better practice to keep it separate from the main element?

1 Answer

Steven Parker
Steven Parker
216,083 Points

A look at the intended meanings of these elements (taken from the MDN pages) might be enlightening:

The main content area consists of content that is directly related to or expands upon the central topic of a document...

The HTML <aside> element represents a portion of a document whose content is only indirectly related to the document's main content. Asides are frequently presented as sidebars or call-out boxes.

So the semantic meanings of these two elements isn't entirely compatible. Putting an aside inside main would be a bit like putting a blue ball in a box labelled "green shapes". They're both indirectly related because they are shapes.

Steven Nava
Steven Nava
Courses Plus Student 5,144 Points

I see -- thank you for that. I need to make better use of MDN. I thought the case was something similar to what you posted but was confused when the teacher's solution included the <aside> element inside of the <main> element. Thank you for helping to clear it up.