英文:
Display address in single column instead of each line of address in its own column
问题
我有一个包含以下内容的Thymeleaf模板:
<td th:text="${tempUser.addressLine1}" />
<td th:text="${tempUser.addressLine2}" />
<td th:text="${tempUser.town}" />
<td th:text="${tempUser.county}" />
<td th:text="${tempUser.country}" />
<td th:text="${tempUser.postcode}" />
地址的每一行都输出到不同的列中。我如何更改这个,以便我的整个地址以以下格式显示在单独的一列中:
Address Line 1
Address Line 2
Town
County
Country
Post Code
英文:
I have a Thymeleaf template whth the following:
<td th:text="${tempUser.addressLine1}" />
<td th:text="${tempUser.addressLine2}" />
<td th:text="${tempUser.town}" />
<td th:text="${tempUser.county}" />
<td th:text="${tempUser.country}" />
<td th:text="${tempUser.postcode}" />
Each line of the address gets output to different column. How can I change this so my Entire address is displayed in a single column in the format:
Address Line 1
Address Line 2
Town
County
Country
Post Code
答案1
得分: 2
如果您不需要表格,可以这样做:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
.container {
display: flex;
flex-direction: column;
}
/*
.container > span {
display: block;
}
*/
<!-- language: lang-html -->
<div class="container">
<span th:text="${tempUser.addressLine1}"></span>
<span th:text="${tempUser.addressLine2}"> </span>
<span th:text="${tempUser.town}"> </span>
<span th:text="${tempUser.county}"></span>
<span th:text="${tempUser.country}"></span>
<span th:text="${tempUser.postcode}"></span>
</div>
<!-- end snippet -->
英文:
If you don't need tables you can do it like this
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
.container {
display: flex;
flex-direction: column;
}
/*
.container > span {
display: block;
}
*/
<!-- language: lang-html -->
<div class="container">
<span th:text="${tempUser.addressLine1}"></span>
<span th:text="${tempUser.addressLine2}"> </span>
<span th:text="${tempUser.town}"> </span>
<span th:text="${tempUser.county}"></span>
<span th:text="${tempUser.country}"></span>
<span th:text="${tempUser.postcode}"></span>
</div>
<!-- end snippet -->
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论