Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 向Angular 11应用程序添加样式表_Css_Angular - Fatal编程技术网

Css 向Angular 11应用程序添加样式表

Css 向Angular 11应用程序添加样式表,css,angular,Css,Angular,我使用ng new hello world创建了一个新项目 使用ngserve运行项目后,我从浏览器中获得了以下源代码 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>HelloWorld</title> <base href="/"> <meta name

我使用
ng new hello world
创建了一个新项目

使用
ngserve
运行项目后,我从浏览器中获得了以下源代码

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HelloWorld</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.css"></head>
<body>
<app-root></app-root>
<script src="runtime.js" defer></script><script src="polyfills.js" defer></script><script src="vendor.js" defer></script><script src="main.js" defer></script></body>
</html>

你好世界

CSS将通过Angular自动注入index.html。要删除此行为,请从angular.json文件中的
styles
中删除
styles.css

要添加新样式,请在
样式中添加其他CSS的路径:

"styles": [
   "assets/css/custom-styles-1.css",
   "assets/css/custom-styles-2.css"
],

有关更多信息,请查看。

谢谢@Xavier Brassoud。我像你一样试过了。我重新启动了构建过程。但它不起作用。