有人可以帮我并排放置三张 table 吗?我目前所有的表格都是从上到下堆叠的。下面是我的代码:
<table style="width:30%">
<tr>
<td><strong>Department:</strong></td>
<td><%= @opportunity.department %></td>
</tr>
<tr>
<td><strong>Agency:</strong></td>
<td><%= @opportunity.agency %></td>
</tr>
</table
<table style="width:30%">
<tr>
<td><strong>Department:</strong></td>
<td><%= @opportunity.department %></td>
</tr>
<tr>
<td><strong>Agency:</strong></td>
<td><%= @opportunity.agency %></td>
</tr>
</table
<table style="width:30%">
<tr>
<td><strong>Department:</strong></td>
<td><%= @opportunity.department %></td>
</tr>
<tr>
<td><strong>Agency:</strong></td>
<td><%= @opportunity.agency %></td>
</tr>
</table
最佳答案
首先,您需要正确关闭 table
像这样的标签
</table>
二、
table
是一个 block 元素,所以你需要指定 display:inline-block
像这样的表格样式:<table style="width:30%;display:inline-block">
关于html - 并排放置三个html表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24000788/