0

I've imported bootstrap CSS into the Angular global style.css, however, the bootstrap styles are being overridden by Angular. For example, my markup renders as this -

<div _ngcontent-c0="" class="container">

but because of the _ngcontent the following CSS gets applied:

margin: 0;
padding: 0;
border: 0;
font-family: inherit

1 Answer 1

4

you can change the order of styles that defined in angular-cli.json file.

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

you should restart your server since angular-cli does not looks for changes in angular.cli.json

Sign up to request clarification or add additional context in comments.

6 Comments

Same issue as above
Have you added the css <link> in your main html?
no, the css gets injected, but angular overrides it.... I don't think I need to add it into the index.html as I added it to the angular-cli.json. Currently the bootstrap CSS is in node_modules, if I was to add it in the index.css, I would need to move the files into the src directory...
probably it is about the version of angular and bootstrap. please check this
Worked for me. Need to restart ng serve.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.