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

How to introduce css in angular

青灯夜游
青灯夜游Original
2021-09-29 17:43:173107browse

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文件路径']

Method 2:

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

[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!

Statement:
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