2

I'm new to angular and was trying to implement something with W3 CSS. I was trying to add this css to my project. Below are the steps I have followed

  1. Ran npm install --save w3-css in my project directory
  2. Added node_modules/w3-css/w3.css in angular.json
"styles": [
          "src/styles.css",
          "node_modules/w3-css/w3.css"
        ],

After that I tried adding css classes to my component html file

<div class="w3-container w3-border w3-large">
    <div class="w3-left-align"><p>Left aligned text.</p></div>
    <div class="w3-right-align"><p>Right aligned text.</p></div>
</div>

But I couldn't see any class added.

Note: node_modules folder and angular json are in same directory.

3
  • Show how you added the css in angular.json Commented Jun 4, 2020 at 18:57
  • @David updated the question Commented Jun 5, 2020 at 6:28
  • "./node_modules/w3-css/w3.css" try this Commented Jun 5, 2020 at 6:30

1 Answer 1

3

import your css in style.css file.

@import "../node_modules/w3-css/w3.css";
Sign up to request clarification or add additional context in comments.

3 Comments

Hey, that worked, but will that not cause any issue during deployment ?
And can you tell me what can be the reason it's not working even though we add it in angular.json's style array ?
no its not cause any deployment issue. may be you are not import css file in correct place at angular.json file.

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.