我正在尝试在 css 中添加背景图片,但出现以下错误
I am trying add a background image in css, but I'm getting the following error
编译失败
错误:
./src/app/shopping-list/shopping-edit/shopping-edit.component.css
Module Error (from ./node_modules/postcss-loader/src/index.js):
(Emitted value instead of an instance of Error) CssSyntaxError:
D:\demoApp\src\app\shopping-list\shopping-edit\shopping-edit.component.css:98:26:
Can't resolve 'assets/header.png' in
'D:\demoApp\src\app\shopping-list\shopping-edit'
代码:
96 | }
97 | .section-testimonials{
> 98 | background-image:url(assets/header.png); ;
| ^
99 | }
100 |
在位置使用引号和正斜杠:
96 | }
97 | .section-testimonials{
> 98 | background-image:url("./assets/header.png"); ;
|
99 | }
100 |
编译失败
错误:
./src/app/shopping-list/shopping-edit/shopping-edit.component.css Module Error (from ./node_modules/postcss-loader/src/index.js): (Emitted value instead of an instance of Error) CssSyntaxError: D:\demoApp\src\app\shopping-list\shopping-edit\shopping-edit.component.css:98:26: Can't resolve 'assets/header.png' in 'D:\demoApp\src\app\shopping-list\shopping-edit'
代码:
96 | }
97 | .section-testimonials{
> 98 | background-image:url(assets/header.png); ;
| ^
99 | }
100 |
在位置使用引号和正斜杠:
96 | }
97 | .section-testimonials{
> 98 | background-image:url("./assets/header.png"); ;
|
99 | }
100 |