慕粉3867151
2017-11-16 16:12
<!doctype html>
<html lang="zh-CH">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>现代浏览器博物馆</title>
<!-- Bootstrap CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collaspe" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link</a> </li>
<li><a href="#">Link</a> </li>
</ul>
</div>
</div>
</nav>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js" ></script>
</body>
</html>
button标签里面的data-toggle属性拼写错了,改成data-toggle="collapse",代码如下:
<!doctype html>
<html>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>现代浏览器博物馆</title>
<!-- Bootstrap CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div>
<div>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span>Toggle navigation</span>
<span></span>
<span></span>
<span></span>
</button>
<a href="#">Brand</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="#">Link</a> </li>
<li><a href="#">Link</a> </li>
</ul>
</div>
</div>
</nav>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js" ></script>
</body>
</html>
基于bootstrap的网页开发
187669 学习 · 734 问题
相似问题