thymeleaf设置css样式,矩形百分比填充背景色

 对调查结果进行统计的页面,在div的style中拼接后台参数,显示百分比

<tr th:each="option:*{obj.list}">
	<td th:text="*{option.title}">选项</td>
	<td th:text="*{option.poll}">小计</td>
	<td th:inline="text">
        <div style="float:left;width:160px; height:15px;
            margin:3px 10px 0 10px;border-style:solid;border-width:1px;">
            <div th:style="'background:#5f8dd4;height:15px;width:'+*{option.rate}+''">
            </div>
        </div>
        <span>[[*{option.rate}]]</span>
    </td>
</tr>

显示效果

猜你喜欢

转载自blog.csdn.net/xiahuale/article/details/84936619