theamleaf CSS内联表达式和js内联表达式和取值类似
<style th:inline="css">
...
</style>
假设我们有两个变量设置为两个不同的String值:
classname = ‘vue1 view1’
align = ‘center’
使用如下表达式
<style th:inline="css">
.[[${classname}]] {
text-align: [[${align}]];
}
</style>
结果将是
<style th:inline="css">
.vue1 view1{
text-align: center;
}
</style>
1
下面给出一个设置theamleaf CSS设置背景的实例
.backGroundImg{
/*background-image: url("http://www.it399.com");*/
background-image: url("[[${myURL.mSrcURL}]]/imgs/tools/zuji/zuji_map_bg.png");
}
个人博客
本文同步发布在 在线助手 ,转载请注明来自 在线助手博客 频道【thymeleaf css内联表达式前端css里面怎么获取后台模板值]】,原文链接:http://www.it399.com/blog/html/201806081526