我从https://v4-alpha.getbootstrap.com/components/navbar/复制了导航代码,但缩小浏览器按钮后,按钮在页面上不可扩展。
我的导航:
<div class="container">
<h3>Navigation</h3>
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
答案 0 :(得分:0)
这是解决方案..
您必须使用正确的等等来使用bootstrap导航栏。
我为你创造了一个例子。那就是
<html lang="en">
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Page 1 <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul>
</li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
</div>
</nav>
<div class="container">
<h3>Divyesh Gausvami here..</h3>
<p>Sharing is caring .</p>
</div>
</body>
</html>
您可以根据此代码使用您的代码。谢谢:))
答案 1 :(得分:0)
首先,你在谈论bootstrap 4而不是bootstrap 3.所以接受的答案的代码是无效的。
接下来您使用的是indexOf
,但代码中使用的类将无法使用bootstrap 3 cdns。
您需要使用下面提到的bootstrap 4 alpha的cdn来使您的代码正常工作。
使用此广告
protected static <T> void exch(List<T> list, int i1, int i2) {
T o1 = list.get(i1);
list.set(i1,list.get(i2));
list.set(i2,o1);
}
工作代码
bootstrap 3.3.7 cdn
&#13;
要了解Bootstrap 3和Bootstrap 4之间的区别,请仔细阅读这些文档 -
https://v4-alpha.getbootstrap.com/getting-started
希望这有帮助!