在Bootstrap 3 navbars上使用NAV和DIV有什么区别? [英] What's the difference between using NAV and DIV around Bootstrap 3 navbars?

查看:784
本文介绍了在Bootstrap 3 navbars上使用NAV和DIV有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最新的Bootstrap 3 navbars的例子中,我发现网络上的外部导航标记为

In examples for the latest Bootstrap 3 navbars, I found various examples on the web where the outer navbar markup is

<div class="navbar navbar-default navbar-static-top">...</div>

等例子正在使用

and other examples are using

<nav class="navbar navbar-default" role="navigation">...</nav>

所有示例均执行OK,文档调用NAV。这让我想知道网络上的很多示例是否是版本2的剩余部分,而不是版本3的重写,或者可以使用周围的标记来确定。

All the examples perform OK, and the documentation calls for NAV. Which leaves me wondering if a lot of examples on the web are version 2 leftovers that were not rewritten for version 3, or it is OK to use either surrounding markup.

< a href =https://github.com/divshot/themestrap/blob/master/examples/kitchen-sink.html =noreferrer>示例

推荐答案

< nav> 是主导航元素的语义HTML5容器元素。

<nav> is the semantic HTML5 container element for you main navigation elements.


nav是一个块级元素,用于表示页面上主要导航链接的一部分。并非所有链接都应该包含在导航元素中。导航应该保留给主要导航部分,包括通用导航,目录,面包屑,上一个/下一个链接或其他值得注意的链接组。

来自 http://learn.shayhowe.com/html-css/elements - 语义学

如果您使用的是HTML5,那么您应该使用nav。

If you are using HTML5 then you should use nav.

这篇关于在Bootstrap 3 navbars上使用NAV和DIV有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆