這是我找到了解決辦法,而不是最整齊的一個,但工程。
所以關鍵就在於,劃分UL中塊多UL認證。 當你只保留ul時,它被視爲一個代碼塊,所以當你減小屏幕尺寸時,整個塊切換到下一行。
<!DOCTYPE html>
<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="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
</ul>
<ul class="nav navbar-nav">
<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>
</ul>
<ul class="nav navbar-nav">
<li><a href="#">Page 2</a></li></ul>
<ul class="nav navbar-nav">
<li><a href="#">Page 3</a></li>
</ul>
<ul class="nav navbar-nav">
<li><a href="#">Page 3</a></li>
</ul>
<ul class="nav navbar-nav">
<li><a href="#">Page 3</a></li>
</ul>
<ul class="nav navbar-nav">
<li><a href="#">Page 3</a></li>
</ul><ul class="nav navbar-nav">
<li><a href="#">Page 3</a></li>
</ul><ul class="nav navbar-nav">
<li><a href="#">Page 3</a></li>
</ul>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<h3>Collapsible Navbar</h3>
<p>In this example, the navigation bar is hidden on small screens and replaced by a button in the top right corner (try to re-size this window).
<p>Only when the button is clicked, the navigation bar will be displayed.</p>
</div>
</body>
</html>
嗨!非常感謝你的回答,這就是我一直在尋找的東西。即使它不是很乾淨,它也會訣竅!謝謝 ! – user6050469