angular - 如何在不干扰/覆盖 Angular Material 设计的情况下以 Angular 使用引导网格样式

标签 angular angular-material npm-install ng-bootstrap

如果我使用 ng-bootstrap,grid style不起作用,但是当我使用 Bootstrap (在 style.css 或 angular.json style[] 数组中提供它)网格样式时它工作正常,但它覆盖了 Angular Material 设计。

ng-bootstrap and bootstrap both I installed from npm

我用了<div class="col-md-6 md-offset-3"></div>

最佳答案

如果你只需要使用 bootstrap 网格,你可以在你的 package.json 中添加依赖:"bootstrap": "4.3.1" npm 我 然后在你的 styles.scss 添加 @import 'bootstrap/dist/css/bootstrap-grid.min.css'; upside Angular Material 主题导入就这样了,你只导入了网格样式,没有导入所有其他东西, Material 主题仍然是一样的。
Here is an example on stackblitz
Here is the source of the unminified file you imported

关于angular - 如何在不干扰/覆盖 Angular Material 设计的情况下以 Angular 使用引导网格样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57289966/

相关文章:

Angular 2 : how to force an injectable to be a singleton in the app

angular - 创建嵌套的Component Angular 6

javascript - Angular Material dialogRef.afterClosed().subscribe 无法处理错误

angular - 为什么 mat-tables matRowDef 包含 2 个变量?

javascript - 定义具有内部内容的自定义卡片组件

javascript - 将 jQuery 与 Angular 一起使用可以吗?

angular - 嵌套的 Angular Material 选项卡

node.js - 无法安装 "@angular/cli"

node.js - 在 Mac 上安装 better-sqlite3 时出现问题

javascript - 运行 maildev 时出错 - logger.info (`Recieved shutdown signal, shutting down now...` )