<tr th:each="folder : ${folders}"> <td style="display: flex;" > <span > <form th:action="@{/show}" method="post"> <input type="hidden" name="objectName" th:value="${folder.getFolderId}"> <input type="hidden" name="objectPath" th:value="${folder.getFolderPath}"> <input type="hidden" name="objectName" th:value="${folder.getFolderName}"> <input type="image" src="/img/查看.jpg" width="150" height="150" th:title="打开文件"></br> </form> </br><p name="objectName" th:text="${folder.getFolderName}"> </span> </td> </tr> </table>怎么在一行显示
时间: 2023-12-28 09:04:15 浏览: 269
可以将每个文件夹的信息放在一个 `<div>` 中,通过设置该 `<div>` 的样式 `display: inline-block;` 将它们在一行内显示。修改代码如下:
```
<tr th:each="folder : ${folders}">
<td>
<div style="display: inline-block;">
<form th:action="@{/show}" method="post">
<input type="hidden" name="objectName" th:value="${folder.getFolderId}">
<input type="hidden" name="objectPath" th:value="${folder.getFolderPath}">
<input type="hidden" name="objectName" th:value="${folder.getFolderName}">
<input type="image" src="/img/查看.jpg" width="150" height="150" th:title="打开文件"></br>
</form>
</br><p name="objectName" th:text="${folder.getFolderName}">
</div>
</td>
</tr>
```
注意,这里将 `<span>` 标签替换为了 `<div>` 标签,并且添加了样式 `display: inline-block;`。
阅读全文