Home > Web Front-end > JS Tutorial > How to introduce css in angular

How to introduce css in angular

青灯夜游
Release: 2023-01-11 09:22:52
Original
3128 people have browsed it

How to introduce css in angular: 1. Set the "@Component({styleUrls:['css file path']})" statement in the ts file; 2. Set "@Component({ styles:[`css style code`]})" statement.

How to introduce css in angular

The operating environment of this tutorial: windows7 system, angular6 version, Dell G3 computer.

angular Two ways to introduce css

Write in ts file @Component({....}) Enter

Method 1:

styleUrls:['css文件路径']
Copy after login

Method 2:

styles:[`
//直接写css样式 格式和在css文件里面一样 例如
a{
color:red;
}
`]
//注意 是反引号`` tab键上面那个
Copy after login

[Related tutorial recommendations: "angular tutorial》】

The above is the detailed content of How to introduce css in angular. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template