【问题标题】:Gif image not working in thymeleaf-html page?Gif 图像在 thymeleaf-html 页面中不起作用?
【发布时间】:2013-10-17 21:53:19
【问题描述】:

在 html 图片和 gif 中设置方式相同。所以我在百里香中使用同样的方法

在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 图像不会在那里显示

我不知道为什么会这样。

如果你知道答案,请在这里分享。

【问题讨论】:

    标签: html image gif thymeleaf


    【解决方案1】:

    @{${run.gif}} 尝试使用属性 run 的属性 gif 重写 URL,我怀疑是否存在。

    如果您想相对于您的上下文引用图像,您应该使用@{/run.gif}。

    文档:Thymeleaf URL Syntax

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-13
      • 2015-02-15
      • 2019-09-14
      • 1970-01-01
      • 1970-01-01
      • 2019-08-10
      • 2018-06-11
      • 2016-08-28
      相关资源
      最近更新 更多