如果我使用 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/