twitter-bootstrap Bootstrap 3 导航药丸不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27854202/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 22:06:52  来源:igfitidea点击:

Bootstrap 3 nav-pills not working

twitter-bootstrapnav-pills

提问by Jess McKenzie

I have followed the documentation but I am unsure why my pillsare not working.

我已经遵循了文档,但我不确定为什么我pills的不工作。

HTML:

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>

采纳答案by tony.0919

What is your expected result ? Can you try to insert some <li>tags to see whether it works properly ?

你的预期结果是什么?你可以尝试插入一些<li>标签,看看它是否正常工作?

<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

仅供参考: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.

还请附上上面指定的 assets/css/style.css 文件。建议将 Bootstrap CDN 放在<head>自定义 css 文件的顶部。

=========== 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:

结果:

enter image description here

在此处输入图片说明

Is that your expected pill effect ?

这是您预期的药丸效果吗?