Bootstrap: Bootstrap type.less file over rides custom CSS

Created on 30 Aug 2016  路  6Comments  路  Source: twbs/bootstrap

I hope version 4 SASS typography CSS file doesn't over ride custom CSS implemented by author.

css v4

Most helpful comment

Your question is somewhat unclear. Cascading Style Sheets, by definition, override CSS included earlier in the document. To ensure that your custom CSS is not overridden you need to move Bootstrap before your custom CSS.

All 6 comments

Your question is somewhat unclear. Cascading Style Sheets, by definition, override CSS included earlier in the document. To ensure that your custom CSS is not overridden you need to move Bootstrap before your custom CSS.

Yeah, this is the nature of CSS. There's no notion of precedence other than selector specificity.
If you don't like _type.scss, then your options are to modify it, delete it, or override its styles in your own CSS.

This is actually a valid point. I am loading Bootstrap first and my app css stylesheets are loaded last and I still get type.less and normalize.less override my app styles.

Selector specificity also matters, not just ordering.

@cvrebert could you be more specific please. what do you mean?

I changed my code to the below in angular.json

"styles": [
              "./node_modules/bootstrap/dist/css/bootstrap.min.css",
              "src/styles/main.scss"
            ]

And this works, I am able to override bootstrap styles with main.scss now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

devdelimited picture devdelimited  路  3Comments

iklementiev picture iklementiev  路  3Comments

matsava picture matsava  路  3Comments

tiendq picture tiendq  路  3Comments

athimannil picture athimannil  路  3Comments