为什么 <div> 似乎比 <nav> 更适合导航栏?
Why does <div> seem to be preferred over <nav> for navigation bars?
根据我目前阅读的内容,<nav>
似乎更好,但我在 Internet 上看到的每个示例都使用 <div ...="nav[igation]">
。
这只是我看到的东西还是人们真的在使用 <div>
?
如果是这样,有什么原因吗?
EDIT :以防万一有人想知道,当然我说的是导航栏,而在其他情况下 nav 不能代替 div.. .
<nav>
较新。很多人还没有赶上。 (或者不得不迎合 Microsoft 不再支持的 Internet Explorer 版本)
<nav>
不是 <div>
的通用替代品(反之亦然)。它是应该用于 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>
比 HTML5 中引入的 <nav>
存在时间长得多,旨在用作通用容器。
根据我目前阅读的内容,<nav>
似乎更好,但我在 Internet 上看到的每个示例都使用 <div ...="nav[igation]">
。
这只是我看到的东西还是人们真的在使用 <div>
?
如果是这样,有什么原因吗?
EDIT :以防万一有人想知道,当然我说的是导航栏,而在其他情况下 nav 不能代替 div.. .
<nav>
较新。很多人还没有赶上。 (或者不得不迎合 Microsoft 不再支持的 Internet Explorer 版本)
<nav>
不是 <div>
的通用替代品(反之亦然)。它是应该用于 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>
比 HTML5 中引入的 <nav>
存在时间长得多,旨在用作通用容器。