0

I am using Magento 2 and added bootstrap 4. I noticed that bootstrap overwrites many basic CSS rules, e.g. it changes the font-size in the body to 1rem.

Normally I could just add bootstrap before the magento 2 CSS to prevent it, but magento 2 is still in their children's shoes and you cant set the order yet.

Is there a version of bootstrap 4 which is not that invasive and which is available from a CDN?

Black
  • 18,150
  • 39
  • 158
  • 271
  • 3
    Interesting question. Maybe you will find some ideas [here](https://stackoverflow.com/a/47251052/3623608) or on [https://bootstrap.build](https://bootstrap.build/), but I guess you have to create the package on your own to fulfill your requirements. – Tommy Aug 25 '20 at 13:34
  • Why do you want to use Bootstrap if you don't want its styles? If you only want specific things then just copy those styles from Bootstrap into your own custom stylesheet (while providing proper attribution). – TylerH Aug 26 '20 at 14:55
  • @TylerH, I wan't it for its responsive styles, but I don't want it to override basic css rules like changing the font-size of the body. *" If you only want specific things then just copy those styles from Bootstrap into your own custom stylesheet"* Then I can't use a CDN and have to serve bootstrap from my own server which slows my website down. – Black Aug 26 '20 at 14:57
  • @Black If you want only basic aspects of CSS preserved then maybe look for a 3rd thing to load after Bootstrap and Magento: a CSS Reset file. That way you can at least just pare stuff down in one place (the CSS Reset file) until only the things you want to reset are reset back to default/initial values. – TylerH Aug 26 '20 at 14:58
  • @TylerH, yes I am working on such a reset file, but it is alot of work to find all places where bootstrap "invaded" the magento style – Black Aug 26 '20 at 14:59
  • I would start with a prefab CSS Reset file and just remove stuff you don't need. But having a custom reversion file is going to "slow down" your website anyway (read: it won't really slow your website down; an additional CSS file will take like 0.1s to load). – TylerH Aug 26 '20 at 15:00

0 Answers0