With semantic HTML, do we no longer use the div element?

With semantic elements the div element is no longer used?

Hi,
From the introduction to semantic HTML, the div element is a non-sematic element which means that the div element does not provide information about the content between the opening tags and closing tags.
We are advised to used semantic HTML element to enhance accessibility, Search Engine Optimization, and readability.

6 Likes

With advanced styling, you will notice that you need to enclose one block within another within another and so on, and in these settings using <div> with class and/or id is just practical. But whenever you build a main structure of your website, you should use semantic elements for all the reasons mentioned before.

7 Likes

I am new to HTML. Now that I know that using div element is non-semantic and we are advised to use semantic HTML elements, why we use div element at all? Does the div element still have purpose?

There is a limited number of semantic elements and you might decide that <div> with a class (like wrapper, container, jumbotron etc) may be more appropriate, particularly when you style your website. This is how I understand and use it. Whenever I can use a semantic element, I favour it, though.

7 Likes

Thanks so much! I appreciate your rapid reply.

is Section Tag considered a Block element