Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I use bootstrap grid style in angular without disturbing/overriding angular material design

If I use ng-bootstrap, grid style does not work but when I use bootstrap (providing it in style.css or in angular.json style[] array) grid style it works fine, but it overrides the angular material designs.

ng-bootstrap and bootstrap both I installed from npm

I used <div class="col-md-6 md-offset-3"></div>

like image 403
Rajesh Malakar Avatar asked Jul 31 '19 11:07

Rajesh Malakar


People also ask

Can I use Angular material and Bootstrap together?

Yes, you can use parts of Angular Material and Bootstrap together in the same web or mobile project. Developers need to be careful not to use the same components, which can clash. Angular Material and Bootstrap offer a variety of unique components for great website design.

What are the important rules that you should follow while using grids in Bootstrap?

Grid System RulesRows must be placed within a .container (fixed-width) or .container-fluid (full-width) for proper alignment and padding. Use rows to create horizontal groups of columns. Content should be placed within columns, and only columns may be immediate children of rows.

Which is better Angular material or Bootstrap?

Angular Material and Flex Layout are absolutely better than bootstrap. But that doesn't mean that you should not use bootstrap, but you may consider utilizing both the libraries.

Can I use Bootstrap grid only?

The Bootstrap Grid can be used alone, without the Bootstrap JavaScript and other CSS Components. You just need to download and reference the “ bootstrap-grid. css ” which contains the Grid and Flexbox classes. More info on only using the Bootstrap Grid CSS is here in the docs.


Video Answer


1 Answers

If you just need to use the bootstrap grid, you can add in your package.json dependencies: "bootstrap": "4.3.1" and npm i then in your styles.scss add @import 'bootstrap/dist/css/bootstrap-grid.min.css'; upside the angular material theme import and there you go, you imported only the grid style without all other stuffs and material theme is still the same.
Here is an example on stackblitz
Here is the source of the unminified file you imported

like image 78
captain hak Avatar answered Oct 31 '22 16:10

captain hak