Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBen Norman
1,192 Pointswhat does the main element do? I thought that would be used where you used the section. is there a standard
I thought the main element was meant to be used where you have used the section element. Should the section element be replaced by the main element?
3 Answers
Agapito Cruz
21,486 PointsFrom my reading of the spec, there is no requirement to use main, so people can use section or divs if they want. I use it because I think it makes things more meaningful, but for some it is a preference thing. BTW, Here is more recent W3C page on it : http://www.w3.org/TR/html-main-element/. The one I posted before is a couple of years out of date.
-Agapito
Agapito Cruz
21,486 PointsHello Ben,
According to the W3C, the main tag is supposed to wrap the main content of the page. As such, they state that there should only be one main element, while a page can have multiple sections. Also,it should never be a child element of other sectioning elements, such as article, aside, footer, header or nav.
Here's the link http://www.w3.org/TR/2012/WD-html-main-element-20121217/.
Hope this helps.
-Agapito
Ben Norman
1,192 PointsYeah, your confirming my suspicions. I was wondering why the How to make a website track / HTML First Stage uses the section instead of main and whether that was actually correct. If main is as you say, the top level element for content like the header and footer then shouldn't main replace section in that tutorial?