使用themeleaf模板,background-image: url()中的图片链接如何写?

方法:

//不多BB
background: url("[[@{/}]]/img/01.jpg");

解读:
“[[@{/}]]”估计是可以找到上下文路径,比如“http://localhost:8080/p2p”,后面的img是static下面的目录,所以配置到一起相当于“http://localhost:8080/p2p/img/01.jpg”

发布了177 篇原创文章 · 获赞 24 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_42449963/article/details/105162007