HTML 表格半列

标签 html html-table

我制作了一个 html 表格,完成后我注意到我犯了一个错误,一行有 5 列,而其他所有列有 3 列。是否可以通过使 2 列只有半列宽或仅使用 html 自动调整它?我不想使用 colspan,因为它是一个非常大的表。

<table border="1">
  <tr>
    <td>something</td>
  </tr>
  <tr>
    <td>these should be</td>
    <td>as long as the others</td>
  </tr>
  <tr>
    <td> something </td>
  </tr>
</table>

最佳答案

嵌套表格

如果您绝对不想使用colspan,您可以尝试嵌套一个表格:

<table border="1">
  <tr>
    <td>something</td>
  </tr>
  <tr>
    <td>
        <table border="1">
             <tr>
                 <td>these should be</td>
                 <td>as long as the others</td>
             </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td> something </td>
  </tr>
</table>

关于HTML 表格半列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26911284/

相关文章:

java - Tapestry 中的确认对话框

javascript - jQuery 不取消选中复选框

html - 隐藏的表格行不显示在它应该显示的位置

html - 表格在 Internet Explorer 中的 div 中不对齐

html - HTML 中的预格式化表格是什么意思?

html - 删除边框后如何删除表格单元格之间的所有间距?

javascript - Jquery attr 不能为 Checkbox Required 属性正常工作

JQuery .on() 事件处理程序用于动态加载图像

javascript - 过滤器 ListView 未正确显示

html - 使用 CSS 覆盖 HTML 表格中的背景