【问题标题】:Display address in single column instead of each line of address in its own column在单列中显示地址,而不是在自己的列中显示地址的每一行
【发布时间】:2021-01-26 13:32:25
【问题描述】:

我有一个 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

【问题讨论】:

    标签: java html spring-boot thymeleaf


    【解决方案1】:

    如果你不需要表格,你可以这样做

    .container {
      display: flex;
      flex-direction: column;
    }
    
    /*
    .container > span {
      display: block;
    }
    */
    <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>

    【讨论】:

      猜你喜欢
      • 2013-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-10
      • 1970-01-01
      • 2017-01-03
      • 2020-08-16
      • 2019-09-16
      相关资源
      最近更新 更多