【问题标题】:How to offset some table cells如何偏移一些表格单元格
【发布时间】:2019-07-05 21:21:44
【问题描述】:

我想画一张如下图的表格。我试图画这个,但输出显示错误。请帮我找出错误。

<table height="600" width="800" border="1" align="center">
  <tr height="350">
    <td width="200" align="center"> Logo </td>
    <td width="200" align="center"> Photo </td>
    <td width="200" align="center"> Info </td>
    <td width="200" align="center"> Gpa </td>
  </tr>
  <tr height="250">
    <td width="225" align="center"> Subject </td>
    <td width="200" align="center"> 1st </td>
    <td width="200" align="center"> 2nd </td>
    <td width="175" align="center"> 3rd </td>
  </tr>
</table>

【问题讨论】:

  • 如果您的列必须不匹配,为什么不制作两个单独的表?
  • 这显然不是表格的用途
  • 第二行:第一个单元格225px,第二个单元格200px,第三个单元格200px和第四个单元格175px。

标签: html css


【解决方案1】:

如果您真的希望表格看起来像这样,这里有一些代码适合您。我基本上把你的桌子一分为二,只给了每一个高度的一半(300而不是600)并相应地设置了边框。

<table height="300" width="800" align="center" style="border: 1px solid #333;">
    <tbody>
    <tr height="350">
    <td width="200" align="center" style="border-right: 1px solid #333;">Logo</td>
    <td width="200" align="center" style="border-right: 1px solid #333;">Photo</td>
    <td width="200" align="center" style="border-right: 1px solid #333;">Info</td>
    <td width="200" align="center">Gpa</td>
    </tr>
    </tbody>
</table>
<table height="300" width="800" align="center" style="border: 1px solid #333; border-top: 0;">
    <tbody>
    <tr height="250">
    <td width="225" align="center" style="border-right: 1px solid #333;">Subject</td>
    <td width="200" align="center" style="border-right: 1px solid #333;">1st</td>
    <td width="200" align="center" style="border-right: 1px solid #333;">2nd</td>
    <td width="175" align="center">3rd</td>
    </tr>
    </tbody>
</table>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-25
    • 1970-01-01
    • 2019-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多