如何合并单元格28和29。

huangapple go评论65阅读模式
英文:

How can I merge cell 28 and 29

问题

当我在单元格28上使用 collspan=2 时,表格的显示效果不好,我的期望是合并单元格28和29而不是分开。

<table width="100%" border="2">
  <tr>
    <td colspan="2" rowspan="2">1</td>
    <td colspan="2">3</td>
    <td colspan="2">5</td>
  </tr>
  <tr>
    <td colspan="2" rowspan="2">9</td>
    <td colspan="2" rowspan="2">11</td>
  </tr>
  <tr>
    <td>13</td>
    <td rowspan="3">14</td>
  </tr>
  <tr>
    <td rowspan="3">19</td>
    <td rowspan="3">21</td>
    <td colspan="2">22</td>
    <td>24</td>
  </tr>
  <tr>
    <td rowspan="2">28</td>
    <td rowspan="2">29</td>
    <td rowspan="2">30</td>
  </tr>
  <tr>
    <td>32</td>  
  </tr>
</table>
英文:

When I use **collspan=2 **on the cell 28 the table doesn't have a good view and my expectation is merge cell 28 and 29 without breaking.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    &lt;table width=&quot;100%&quot; border=&quot;2&quot;&gt;
      &lt;tr&gt;
        &lt;td colspan=&quot;2&quot; rowspan=&quot;2&quot;&gt;1&lt;/td&gt;
        &lt;td colspan=&quot;2&quot;&gt;3&lt;/td&gt;
        &lt;td colspan=&quot;2&quot;&gt;5&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td colspan=&quot;2&quot; rowspan=&quot;2&quot;&gt;9&lt;/td&gt;
        &lt;td colspan=&quot;2&quot; rowspan=&quot;2&quot;&gt;11&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;13&lt;/td&gt;
        &lt;td rowspan=&quot;3&quot;&gt;14&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td rowspan=&quot;3&quot;&gt;19&lt;/td&gt;
        &lt;td rowspan=&quot;3&quot;&gt;21&lt;/td&gt;
        &lt;td colspan=&quot;2&quot;&gt;22&lt;/td&gt;
        &lt;td&gt;24&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td rowspan=&quot;2&quot;&gt;28&lt;/td&gt;
        &lt;td rowspan=&quot;2&quot;&gt;29&lt;/td&gt;
        &lt;td rowspan=&quot;2&quot;&gt;30&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;32&lt;/td&gt;  
      &lt;/tr&gt;
    &lt;/table&gt;

<!-- end snippet -->

答案1

得分: 1

Simple typo. you tried collspan, but it's colspan.

the full table row should look like this:

<tr>
  <td rowspan="2" colspan="2">28 + 29</td>
  <td rowspan="2">30</td>
</tr>

A word of advice from a very old coder:
learning this level of table trickery was important in 1999,
before CSS and flexbox and grid came along.

Now it's irrelevant.

英文:

Simple typo. you tried collspan, but it's colspan.

the full table row should look like this:

  &lt;tr&gt;
    &lt;td rowspan=&quot;2&quot; colspan=&quot;2&quot;&gt;28 + 29&lt;/td&gt;
    &lt;td rowspan=&quot;2&quot;&gt;30&lt;/td&gt;
  &lt;/tr&gt;

A word of advice from a very old coder:
learning this level of table trickery was important in 1999,
before CSS and flexbox and grid came along.

Now it's irrelevant.

答案2

得分: 0

请检查图片 @epascarello @bjelli

英文:

如何合并单元格28和29。

Please check the image @epascarello @bjelli

huangapple
  • 本文由 发表于 2023年2月18日 02:15:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75487929.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定