为啥IDEA无法识别css文件中的本站绝对路径?

Spring Boot可以把/resource/static目录当做静态文件目录,在这个目录下的文件可以直接访问。

想在css中引用本站的图片作为背景,图片在/resource/static/img目录下,css如下:

把这个样式写在/static目录下的css文件中IDEA会报错,但是如果把这个样式直接写在html文件的style标签中IDEA不会报错。

这是IDEA的bug吗?还是需要下载什么插件?

回答

你用的哪个版本idea呢?
我是windows10 系统,使用的是IntelliJ IDEA 2021.2.2
和IntelliJ IDEA 2017.3.4 x64

我这个没有报错,前端使用的 thymeleaf,也是可以的。

<a href="#" role="button" aria-haspopup="true" aria-expanded="false">
	<img src="https://q.cnblogs.com/avatars/user.jpg" alt="Jason's Photo">
	<span>
		<small>欢迎您,</small>
		<div th:text="${session.aname}"></div>
	</span>
	<i></i>
</a>

参考: 《Spring Boot 实战纪实》

以上是为啥IDEA无法识别css文件中的本站绝对路径?的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>