使用来自百日咳的th:text属性后,Materialisecss图标从html中消失

时间:2018-03-21 17:51:13

标签: java spring-mvc thymeleaf materialize

我目前正在使用Spring学习Web应用程序开发,在此期间我遇到了烦人的问题。

所以让我们谈谈这一点。我正在使用materializecss,它允许使用带有图标的按钮:

<button class="waves-effect waves-light btn" type="submit" name="save">Send
    <i class="material-icons left">send</i>
</button>

我得到一个带图标的漂亮按钮: link

但是一旦我添加了一个百里香叶属性:文本就会导致图标消失。

这是代码:

<button class="waves-effect waves-light btn" type="submit" name="save"
        th:text="#{submit}">Send
    <i class="material-icons right">send</i>
</button>

你知道可能是什么原因吗?

1 个答案:

答案 0 :(得分:0)

th:文本覆盖所有子标签。您必须将文本移动到它自己的标记。像这样,例如:

<button class="waves-effect waves-light btn" type="submit" name="save">
    <span th:text="#{submit}" />
    <i class="material-icons right">send</i>
</button>
相关问题