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 trialJake Almendarez
Front End Web Development Techdegree Student 4,250 Pointswhy use class="primary-content" for div instead of using the <main> element?
i just noticed in the lesson he used a class for a div to specify the main content. why not use the <main> semantic element?
1 Answer
Tufan Ovidiu
Front End Web Development Techdegree Student 5,100 PointsMaybe he was just using it as an example and there was no underline meaning.
The <main> HTML tag is used as a primary element and it should not be repeated. It also has other roles like replacing the landmark meaning of the <div role="main" >.
The main/header/article tags are just informative and used for robots to understand what your page contains. Please check schema.org to understand more about tags and also - > https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Main_role
Your question is good, but it's not a general rule to use that tag; You need to be flexible sometimes. Your course is on CSS not on HTML tags so don't get concerned about that.
I hope this gives you more insights.