Some of Bootstrap\'s examples use div.navbar
to hold the navigation bar, and other examples (e.g., in the Components documentation page) use nav.navbar
Both will output same design but using nav
tag is more semantic in approach. It represents main navigation of your page. using nav tag helps search engine recognize which is your main navigation on the page. there might be other links too but your top menu is the main menu.
Hope this helps
Nav
is semantically more correct and is preferred over Div
. As to some answers I have read, Div
is often regarded as the last option to use in any element but we often see the opposite.
MDN Definition Nav
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. Here's the MDN Page Link for Nav Element
As I searched some more on the internet for Navbar
, all I can get from that is Navbar
is specifically for Links and Button Elements. It is used inside Nav
, as we see it being used in bootstrap docs.