html - 并排放置三个html表格

标签 html css html-table placement

有人可以帮我并排放置三张 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/

相关文章:

html - 如何保持元素菜单的高亮

javascript - 根据滚动期间当前可见的内容突出显示索引中的元素

javascript - 执行 window.print 时的边距和填充问题

html - 发送到客户端之前,请在Grails 3中修改响应的呈现字符串。

javascript - 我的 jQuery 链接不正确

javascript - ajax成功后无法删除表行

html - CSS 在数据单元格上方显示表格行标题

html - 简单的 XML 到 HTML 表格

html - 为什么 PC 浏览器读取 HTML/CSS 页面的方式与 iPad 不同?

javascript - 如何在javascript中为每个频谱条添加类?