![](/img/trans.png)
[英]Thymeleaf - How to compare string with request parameter in html in Thymeleaf tag “th:if”?
[英]Thymeleaf HTML <i> Tag
我在模板中定义了HTML <i>标记,该标记正在将bean的color属性替换为style属性。 但是不替换Bean属性的颜色
<i class="fa fa-exchange fa-2x" style="color:'${book.htmlIconColor}'; text-align: center;" aria-hidden="true"></i>
您可以使用生成样式属性的th:style
来实现。
<i class="fa fa-exchange fa-2x"
th:style="'color:' + ${book.htmlIconColor} + '; text-align: center;'"
aria-hidden="true"></i>
或替代方法
<i class="fa fa-exchange fa-2x"
th:style="${'color:' + book.htmlIconColor + '; text-align: center;'}"
aria-hidden="true"></i>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.