html rowspan的怪象,求大神答疑!!!

100 阅读1分钟

偶然发现当表格的首行都出现rowspan属性,值大于2时,会出现渲染异常问题。如下:

rowspan 都等于 2 时

<table>
<thead>
  <tr>
    <th>月份</th>
    <th>存款</th>
    <th rowspan="3">节假日的储蓄!</th>
  </tr>
</thead>
<tbody>
  <tr>
    <th rowspan="2">0</th>
    <th rowspan="2">0</th>
    <th rowspan="2">0!</th>
  </tr>
  <tr>
    <td>一月</td>
    <td>¥3000</td>
    <td rowspan="0">¥6000</td>
  </tr>
  <tr>
    <td>二月</td>
    <td>¥4000</td>
  </tr>
</tbody>
</table>

image.png

rowspan 都等于 3 时

<table>
<thead>
  <tr>
    <th>月份</th>
    <th>存款</th>
    <th rowspan="3">节假日的储蓄!</th>
  </tr>
</thead>
<tbody>
  <tr>
    <th rowspan="3">0</th>
    <th rowspan="3">0</th>
    <th rowspan="3">0!</th>
  </tr>
  <tr>
    <td>一月</td>
    <td>¥3000</td>
    <td rowspan="0">¥6000</td>
  </tr>
  <tr>
    <td>二月</td>
    <td>¥4000</td>
  </tr>
</tbody>
</table>

image.png