Difference between nav vs div.navbar in Bootstrap

前端 未结 2 692
隐瞒了意图╮
隐瞒了意图╮ 2021-01-02 00:39

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

2条回答
  •  迷失自我
    2021-01-02 01:43

    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

    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.

提交回复
热议问题