为什么我的CSS不使用bootstrap?

时间:2014-12-04 16:13:47

标签: html css angularjs twitter-bootstrap

尝试在我的项目上运行bootstrap但是它没有工作没有样式出现在本地主机上我已经添加了cdnjs链接到我的索引文件。试图最初在项目上设置导航栏,但似乎在文件上有很多错误。

headers.html

 <nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" 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>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
        <li><a href="#">Link</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu" role="menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
            <li class="divider"></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
      <form class="navbar-form navbar-left" role="search">
        <div class="form-group">
          <input type="text" class="form-control" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">Submit</button>
      </form>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#">Link</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu" role="menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

的index.html

<!DOCTYPE html>
<html ng-app="UploadAdmin">
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Upload Admin</title>

      <link rel="stylesheet" href="bower_components/kendo/styles/kendo.common.min.css"/>
      <link rel="stylesheet" href="bower_components/kendo/styles/kendo.default.min.css"/>
      <link rel="stylesheet" href="bower_components/kendo/styles/kendo.dataviz.min.css"/>
      <link rel="stylesheet" href="bower_components/kendo/styles/kendo.dataviz.default.min.css"/>

      <link rel="stylesheet" href="http://cdn.kendostatic.com/2014.2.1008/styles/kendo.common-bootstrap.min.css">
      <link rel="stylesheet" href="http://cdn.kendostatic.com/2014.2.1008/styles/kendo.bootstrap.min.css">

      <script src="bower_components/jquery/jquery.min.js"></script>
      <script src="bower_components/angular/angular.min.js"></script>
      <script src="bower_components/angular-route/angular-route.min.js"></script>
      <script src="bower_components/angular-resource/angular-resource.min.js"></script>
      <script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>
      <script src="bower_components/kendo/js/kendo.all.min.js"></script>
  </head>

  <body>
      <div class="container" ng-controller="UploadController">
          <div ng-include src="'views/header.html'"></div>
          <div ng-view class="container-fluid"></div>
          <div ng-include src="'views/footer.html'"></div>
      </div>

      <script src="scripts/app.js"></script>
      <script src="scripts/controllers.js"></script>
  </body>
</html>

1 个答案:

答案 0 :(得分:0)

如果你正在使用bower,请尝试将bootstrap依赖项添加到bower.json文件中:

  "dependencies": {
    "angular": "~1.3.3",
    "bootstrap": "~3.2.0"
  },

并将以下内容添加到您的index.html文件中(<link> in the head <script>,其他脚本标记位于底部):

<link href="bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet">

<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>

不要忘记你目录中的bower install