在 html 中图像和 gif 的设置方式相同。所以我在 thymeleaf 中使用相同的方法
在thymeleaf中图像设置为
<img th:attr="src=@{${ball.png}} , title=#{background}, alt=#{background}" style="width: 150px; height: 150px;" />
同gif图片设置为
<img th:attr="src=@{${run.gif}} , title=#{background}, alt=#{background}" style="width: 150px; height: 150px;" />
图像会在那里显示,但 gif 图像不会在那里显示
我不知道为什么会这样。
如果您知道答案,请在这里分享。
最佳答案
@{${run.gif}}
尝试使用属性 run
的属性 gif
重写 URL,我对此表示怀疑是。
如果你想相对于你的上下文引用图像,你应该做 @{/run.gif}
。
关于html - Gif 图像在 thymeleaf-html 页面中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19290665/