将地址显示在单列中,而不是每行地址都显示在自己的列中。

huangapple go评论59阅读模式
英文:

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 &gt; span {
  display: block;
}
*/

<!-- language: lang-html -->

&lt;div class=&quot;container&quot;&gt;
  &lt;span th:text=&quot;${tempUser.addressLine1}&quot;&gt;&lt;/span&gt;
  &lt;span th:text=&quot;${tempUser.addressLine2}&quot;&gt; &lt;/span&gt;
  &lt;span th:text=&quot;${tempUser.town}&quot;&gt; &lt;/span&gt;
  &lt;span th:text=&quot;${tempUser.county}&quot;&gt;&lt;/span&gt;
  &lt;span th:text=&quot;${tempUser.country}&quot;&gt;&lt;/span&gt;
  &lt;span th:text=&quot;${tempUser.postcode}&quot;&gt;&lt;/span&gt;
&lt;/div&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2020年10月12日 16:41:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/64314419.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定