简体   繁体   English

复杂的HTML表无法验证:表行“超过了第一行建立的列数”

[英]Complex HTML table not validating: table row “exceeded the column count established by the first row”

validator.w3.org is giving me the error: validateator.w3.org给我错误:

A table row was 4 columns wide and exceeded the column count established by the first row (1). 表格行的宽度为4列,超过了第一行(1)所建立的列数。

It looks like this: 看起来像这样:

|1|2.1|2.2    |
| |3.1|3.2|3.3|
| |4.1|4.4|4.5|
<table>
  <tbody>
    <tr>
      <td rowspan="4"> 1 </td>
    </tr>
    <tr>
      <td> 2.1 </td>
      <td colspan="2"> 2.2 </td>
    </tr>
    <tr>
      <td> 3.1 </td>
      <td> 3.2 </td>
      <td> 3.3 </td>
    </tr>
    <tr>
      <td> 4.1 </td>
      <td> 4.2 </td>
      <td> 4.3 </td>
    </tr>
  </tbody>
</table>

I simplified the data, the code is from Mathematical Principles of Natural Philosophy by Sir Isaac Newton, obviously he did not understand HTML table rules any better then I do. 我简化了数据,代码来自艾萨克·牛顿爵士的《自然哲学数学原理》 ,显然他不比我更了解HTML表规则。

Actual Table: http://lightwizzard.com/books/mathematical.philosophy/mathematical.principles.of.natural.philosophy.html#book3.2.68 实际表格: http//lightwizzard.com/books/mathematical.philosophy/mathematical.principles.of.natural.philosophy.html#book3.2.68

You've to combine your two first rows and change rowspan of the first field: 您必须合并两个第一行并更改第一个字段的行跨度:

<table>
  <tbody>
    <tr>
      <td rowspan="3"> 1 </td>
      <td> 2.1 </td>
      <td colspan="2"> 2.2 </td>
    </tr>
    <tr>
      <td> 3.1 </td>
      <td> 3.2 </td>
      <td> 3.3 </td>
    </tr>
    <tr>
      <td> 4.1 </td>
      <td> 4.2 </td>
      <td> 4.3 </td>
    </tr>
  </tbody>
</table>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM