我在 thymeleaf 中有以下行
<td th:text="${#numbers.formatDecimal(p.position, 0, 'WHITESPACE', 4, 'POINT')}">POSITION</td>
因此,为了可读性,在长数字中使用空格作为分隔符。 否则这是可行的,但现在我在表格中的数字中间有换行符,这使得比以前更难以阅读。 像这样:
160
120.3292
有没有办法使用“
”类型的字符或其他东西?
最佳答案
使用CSS来防止换行。 (white-space: nowrap
应该适用于此。)
<td th:text="${#numbers.formatDecimal(p.position, 0, 'WHITESPACE', 4, 'POINT')}" style="white-space: nowrap;">POSITION</td>
关于java - Thymeleaf,不要在数字中插入换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53374715/