[英]Formatting a tag is not working with Thymeleaf
Why does this piece of code display the image before the text: 为什么这段代码在文本之前显示图像:
<p>
<span>
<img src="../assets/images/favorite.svg" height="12px"/>
</span>
Baked Alaskan Salmon with Asparagus
</p>
But when formatted with Thymeleaf it does not display the image: 但是当用Thymeleaf格式化时,它不会显示图像:
<p th:text="@{' ' + ${recipe.name}}">
<span>
<img src="../assets/images/favorite.svg" height="12px"/>
</span>
Baked Alaskan Salmon with Asparagus
</p>
Try using Thymleaf's
th:inline="text"
tag to display html content inside of Thymleaf
processed tags. 尝试使用
Thymleaf's
th:inline="text"
标签在Thymleaf
处理过的标签内显示html内容。 Following code should work, i have not tested it though 下面的代码应该工作,虽然我没有测试过
<p th:inline="text">
[[@{' ' + ${recipe.name}}]]
<span>
<img src="../assets/images/favorite.svg" style="height:12px"/>
</span>
Baked Alaskan Salmon with Asparagus
</p>
For more description on how inline
tag works check out the docs 有关
inline
代码如何工作的更多说明,请查看文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.