问题
I have followed the documentation but I am unsure why my pills
are not working.
HTML:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script src="assets/js/script.js"></script>
<link rel="stylesheet" media="all" href="assets/css/style.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<nav class="nav navbar-nav">
<ul class="nav nav-pills">
<li>blah</li>
</ul>
</nav>
</div>
</div>
</body>
</html>
回答1:
What is your expected result ? Can you try to insert some <li>
tags to see whether it works properly ?
<ul class="nav nav-pills">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
FYI: http://getbootstrap.com/components/#nav-pills
Please also attach the assets/css/style.css file specified above. It is suggested to place the Bootstrap CDN at the top of <head>
, above your custom css file.
=========== Updates ===========
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<nav class="nav navbar-nav">
<ul class="nav nav-pills">
<li role="presentation"><a href="#">Blah</a></li>
<li role="presentation"><a href="#">Blah</a></li>
<li role="presentation"><a href="#">Blah</a></li>
</ul>
</nav>
</div>
</div>
</body>
</html>
Result:

Is that your expected pill effect ?
来源:https://stackoverflow.com/questions/27854202/bootstrap-3-nav-pills-not-working