【问题标题】:The 'btn-outline-*' class on bootstrap v4 is not applied未应用 bootstrap v4 上的“btn-outline-*”类
【发布时间】:2019-10-02 08:36:44
【问题描述】:

我正在使用 Angular & Bootstrap v4.3.1 编写一个简单的网络应用程序。 我喜欢 Bootstrap v4 中的“大纲按钮”类。但是下班后,“btn-outline-*”类仍然无效...

我运行 npm install bootstrap@latest 来安装 bootstrap v4.3.1。 在 angular.json 文件中,我插入了 'architect:build:options:styles :

"../node_modules/bootstrap/dist/css/bootstrap.css"

我尝试安装 @ng-bootstrap/ng-bootstrap 但未能在 app-module.ts 中导入它:* 错误:“NgbModule 不是 Angular模块"*

实际上,没有任何效果,结果与“btn-outline-*”类不存在一样。

HTML

<li class="list-group-item" xmlns:disabled="http://www.w3.org/1999/xhtml">
    <h3 class="col-lg-8" style="margin-top: 0; padding-left: 0; vertical-align: center">{{title}}</h3>
      <p class="col-lg-4" style="text-align: right; vertical-align: center">Posté le : {{createdAt | date : 'medium'}}</p>

    <div style="display: inline-block">{{content}}</div>
    <div style="margin-top: 10px">
      <button class="btn btn-outline-success btn-rating"
              (click)="onLike()">I love it !</button>
      <button class="btn btn-outline-danger btn-rating"
              (click)="onDislike()">I don't love it !</button>
    </div>
</li>

btn 类已正确应用,但 btn-outline-successbtn-outline-danger 仍然无法正常工作。 . 你有解决办法吗?

【问题讨论】:

  • 正确的路径是node_modules/[...],而不是../node_modules/[...]
  • 很可能是导入问题,请考虑使用this 包。
  • @BastienDufour 没问题,然后回答

标签: javascript css angular twitter-bootstrap button


【解决方案1】:

按照我的评论,您的路径是错误的。替换

../node_modules/bootstrap/dist/css/bootstrap.css

node_modules/bootstrap/dist/css/bootstrap.css

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-15
    • 2019-03-18
    • 2014-01-03
    • 1970-01-01
    • 1970-01-01
    • 2020-07-11
    • 2019-10-16
    相关资源
    最近更新 更多