0

According to what I've read so far, <nav> seems to be better, but every single example I see on the Internet uses <div ...="nav[igation]">.

Is it just me seeing things or do people really use <div> ?
If so, is there a reason why ?

EDIT : just in case someone was wondering, of course I'm talking about navigation bars, and nav can't replace div in other cases...

2 Answers2

1

<nav> is not a generic replacement for <div> (or vice-versa). It's a semantic element that should be used for navigation.

The HTML <nav> element represents a section of a page whose purpose is to provide navigation links, either within the current document or to other documents. Common examples of navigation sections are menus, tables of contents, and indexes (MDN).

<div> has been around much longer than <nav>, which was introduced in HTML5, and is intended to be used as a generic container.

j08691
  • 204,283
  • 31
  • 260
  • 272
0

<nav> is newer. Lots of people haven't caught up yet. (Or are stuck having to cater to versions of Internet Explorer that Microsoft no longer supports)

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335