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

Tati Gvozdik
Tati Gvozdik
746 Points

Why Guil doesn't use <main> section when he uses <article> ?

Why Guil doesn't use <main> section when he uses <article> in his video "Marking Up a Blog Post"? He has mentioned that "an article is a self contained component in a page". So what? I don't need use <main> section after this?

Matthew Lawson
Matthew Lawson
7,283 Points

I guess you could use the <main> tag if you wanted to add any particular style elements to the main area of the page.

2 Answers

Emmanuel Molina
Emmanuel Molina
9,268 Points

According to the W3C specification there is only one <main> per page and it must never has an <article> as a parent.

https://www.w3.org/TR/html5/grouping-content.html#the-main-element

But the MDN partially disagree :

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main

Choose your side :)

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Hi Tati Gvozdik,

You could also use <main>. I used <article> to represent a full self-contained composition.