百里香<img><div th:text> 里面 [英] Thymeleaf <img> inside <div th:text>
本文介绍了百里香<img><div th:text> 里面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要文字环绕图像.我有
<img style="float: left" th:style="${row.getFeed2().getImage() == null} ? 'default' : 'none'" th:src="${row.getFeed2().getImage()}">
但是 Thymeleaf 删除了内部标签 我已经探索了很多选择,但没有任何效果.
提前致谢
解决方案
将文本移动到另一个标签内.像这样:
<span th:text="${row.getFeed2().getDescription}"/><img style="float: left" th:style="${row.getFeed2().getImage() == null} ? 'default' : 'none'" th:src="${row.getFeed2().getImage()}">
编辑 2(无跨度):
<th:block th:text="${row.getFeed2().getDescription}"/><img style="float: left" th:style="${row.getFeed2().getImage() == null} ? 'default' : 'none'" th:src="${row.getFeed2().getImage()}"></span>
或
[[${row.getFeed2().getDescription}}]]<img style="float: left" th:style="${row.getFeed2().getImage() == null} ? 'default' : 'none'" th:src="${row.getFeed2().getImage()}"></span>
I need text wraps around the image. I have
<div th:text="${row.getFeed2().getDescription}">
<img style="float: left" th:style="${row.getFeed2().getImage() == null} ? 'default' : 'none'" th:src="${row.getFeed2().getImage()}">
</div>
But Thymeleaf deletes inner tag <img>
I have explored many options and nothing works.
Thank you in advance
解决方案
Move the text inside another tag. Something like this:
<div>
<span th:text="${row.getFeed2().getDescription}" />
<img style="float: left" th:style="${row.getFeed2().getImage() == null} ? 'default' : 'none'" th:src="${row.getFeed2().getImage()}">
</div>
Edit 2 (without span):
<span>
<th:block th:text="${row.getFeed2().getDescription}" />
<img style="float: left" th:style="${row.getFeed2().getImage() == null} ? 'default' : 'none'" th:src="${row.getFeed2().getImage()}">
</span>
or
<span th:inline="text">
[[${row.getFeed2().getDescription}}]]
<img style="float: left" th:style="${row.getFeed2().getImage() == null} ? 'default' : 'none'" th:src="${row.getFeed2().getImage()}">
</span>
这篇关于百里香<img><div th:text> 里面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文