对于响应式和固定导航栏,请使用以下代码:
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button"class="navbar-toggle collapsed" data-toggle="collapse" data-target="ID-name or class_name" aria-expanded="false">
<span class="sr-only">toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
然后将您的代码包装在此 div 下...
<div class="collapse navbar-collapse" id="ID name or class name">
...
</div>
注意- *ID 名称或类名称应在两个地方相同
For id= "# id_name"
For className id=".class_name"