The Nav tag confusion

The Nav tag confusion

Hello everyone!
I have a question: what is the different between nav tag and div tag?
what’s the things that nav do that div can’t do?
they can both be styled, include links.
so can you please help me to understand it better?
Thank you :blush:

1 Like

nothing really is important for the two but is based on html5 new declaration of element tags
to fit their purpose, you can use div on the whole site but it would be lot more confusing when trying to debug, but using header nav article aside section footer helps you understand more about your code and how to tackle bugs… But naturally many coders use div tag for everything…

Html5 is a more welcoming approach to readable and reusable code

1 Like

Well, using semantic tags is for optimising how screen readers and search engines read your page, so it is a best practice thing to make your site more accessible and searchable

1 Like

I will try to keep it simple and short. Basically every tag you use in mark up is a container, so div , nav, header, footer, section all are just wrappers. Difference is some tags are semantic (means you know what kind of content the wrapper is holding) while some aren’t. So your initial question is answered above that their’s is no difference between nav and div.

1 Like

In HTML 5, it’s advised to use the semantic elements to make the website or app accessible to people with visual, auditory, mobility, or cognitive disabilities. Hence the reason for nav, header, article, section etc.

1 Like

Thank you so much guys