[英]Unable to use external css stylesheet in angular 9 project
I'm new to angular and was trying to implement something with W3 CSS.我是 angular 的新手,并试图用 W3 CSS 实现一些东西。 I was trying to add this css to my project.
我试图将此 css 添加到我的项目中。 Below are the steps I have followed
以下是我遵循的步骤
node_modules/w3-css/w3.css
in angular.jsonnode_modules/w3-css/w3.css
8CBA22E28EB17B5F5C6AE2A266AZ"styles": [ "src/styles.css", "node_modules/w3-css/w3.css" ],
After that I tried adding css classes to my component html file之后,我尝试将 css 类添加到我的组件 html 文件中
<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.但我看不到任何 class 添加。
Note: node_modules folder and angular json are in same directory.注意:node_modules 文件夹和 angular json 在同一目录下。
import your css in style.css file.在 style.css 文件中导入您的 css。
@import "../node_modules/w3-css/w3.css";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.