【问题标题】:Unable to use Bootstrap library in Angular无法在 Angular 中使用 Bootstrap 库
【发布时间】:2019-01-01 06:15:23
【问题描述】:

标题代码

<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Home</a></li>
      <li><a href="#">Page 1</a></li>
      <li><a href="#">Page 2</a></li>
      <li><a href="#">Page 3</a></li>
    </ul>
  </div>
</nav>

angular.json 代码

"styles": [
              "src/styles.css",
              "../prab/node_modules/bootstrap/dist/css/bootstrap.min.css"
            ],

我无法在输出窗口中看到引导 css

【问题讨论】:

标签: angular bootstrap-4


【解决方案1】:

或者,如果您不想更新 angular.json 文件,您可以改为更新 styles.css 文件,如下所示:

/* You can add global styles to this file, and also import other style files */
@import "~bootstrap/dist/css/bootstrap.min.css";
@import "~font-awesome/css/font-awesome.min.css";

div.card-header {
 font-size: large;
}

div.card {
  margin-top: 10px
}

.table {
  margin-top: 10px
}

【讨论】:

    【解决方案2】:

    将代码改为:

    "styles": [
        "../node_modules/bootstrap/dist/css/bootstrap.min.css",
        "styles.css"
    ]
    

    已经回答了,看这个

    How to use Bootstrap css Library in Angular 2 project?

    【讨论】:

      猜你喜欢
      • 2019-08-22
      • 2017-04-09
      • 2015-10-04
      • 2018-10-26
      • 2017-04-08
      • 2019-06-25
      • 1970-01-01
      • 2019-03-11
      • 1970-01-01
      相关资源
      最近更新 更多