Using Class/ID in Semantic Tags

Working on this exercise:

When I’m replacing the non-semantic “div” tags with semantic tags like “main” and “footer”, should I still keep an ID or Class associated with tag?

For example: main id=“main”. When referencing the element in the CSS file, is there any benefit from referencing from the actual element type, verse the element ID or class?


If we are to assume there will be only one MAIN element, then that is enough to hook it with CSS or JS (using a type selector). The only reason for giving it an id is if one wishes to hook it with an HREF…

 <a href="#main">Main</a>
1 Like