我有一段代码:
<div class="col-md-3 col-sm-6 text-center">
<a href="/" class="logo logo_image">
<span>
<block >Plats</block>
<span class="muellerhoff" >Bruts</span>
</span>
<img src="http://172.114.143.253:7080/images/logo.png" >
</a>
</div>
我在浏览器上看到:
但当我使用胸腺素时:
<div class="col-md-3 col-sm-6 text-center">
<a href="/" class="logo logo_image">
<th:block th:text="${@environment.getProperty('site.name1')}" />
<span class="muellerhoff" th:text="${@environment.getProperty('site.name2')}"></span>
<img th:src="@{/images/logo.png}" th:alt="${@environment.getProperty('site.name')}" th:title="{@environment.getProperty('site.name')}">
</a>
</div>
样式丢失:
当我查看源代码时,我看到:
<div class="col-md-3 col-sm-6 text-center">
<a href="/" class="logo logo_image">
Plats
<span class="muellerhoff">Bruts</span>
<img th:src="@{/images/logo.png}" th:alt="${@environment.getProperty('site.name')}" th:title="{@environment.getProperty('site.name')}">
</a>
</div>
我也试过了 <block th:text="${@environment.getProperty('site.name1')}" />
同样的结果
1条答案
按热度按时间tag5nh1u1#
thymeleaf th:块与html标记不同
<block>
. 如果您的第一个html代码段按预期工作,那么使用thymeleaf增强它应该如下所示。。。