CSS CSS Basics Basic Selectors Class Selectors

Jake Almendarez
Jake Almendarez
Front End Web Development Techdegree Student 4,249 Points

why 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
Tufan Ovidiu
5,095 Points

Maybe 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.