[英]Validating html code, error Table column 2 established by element th has no cells beginning in it
My code seams to work fine but trying to validate it at https://validator.w3.org/nu/#file it gives me error: Table column 2 established by element th has no cells beginning in it.我的代码接缝工作正常,但尝试在https://validator.w3.org/nu/#file验证它给我错误:由元素 th 建立的表列 2 没有单元格开头。 If I remove the rowspan attribute I get no errors.
如果我删除 rowspan 属性,则不会出现任何错误。 How could this be?
这怎么可能?
<table>
<caption>Average salary</caption>
<tr>
<th colspan="2" rowspan="2">Occupation</th>
<th colspan="2">Salary (kr)</th>
</tr>
<tr>
<th>Men</th>
<th>Women</th>
</tr>
<tr>
<td colspan="2">Ambulance nurse</td>
<td>37 400</td>
<td>36 800</td>
</tr>
<tr>
<td colspan="2">Consultant system development</td>
<td>43 000</td>
<td>43 500</td>
</tr>
<tr>
<td colspan="2">High school teacher</td>
<td>35 000</td>
<td>35 400</td>
</tr>
<tr>
<td colspan="2">Dentist</td>
<td>44 400</td>
<td>46 100</td>
</tr>
<tr>
<td colspan="2">Air lane leader</td>
<td>65 700</td>
<td>66 500</td>
</tr>
<tr>
<td colspan="2">Bar manager</td>
<td>23 000</td>
<td>23 000</td>
</tr>
<tr>
<td colspan="2">Home service assistant</td>
<td>27 100</td>
<td>27 400</td>
</tr>
</table>
What I want to achieve is this structure我想要实现的是这种结构
The solution was this code:解决方案是这样的代码:
<table>
<caption>Average salary</caption>
<tr>
<th rowspan="2">Occupation</th>
<th colspan="2">Salary (kr)</th>
</tr>
<tr>
<th>Men</th>
<th>Women</th>
</tr>
<tr>
<td>Ambulance nurse</td>
<td>37 400</td>
<td>36 800</td>
</tr>
<tr>
<td>Consultant system development</td>
<td>43 000</td>
<td>43 500</td>
</tr>
<tr>
<td>High school teacher</td>
<td>35 000</td>
<td>35 400</td>
</tr>
<tr>
<td>Dentist</td>
<td>44 400</td>
<td>46 100</td>
</tr>
<tr>
<td>Air lane leader</td>
<td>65 700</td>
<td>66 500</td>
</tr>
<tr>
<td>Bar manager</td>
<td>23 000</td>
<td>23 000</td>
</tr>
<tr>
<td>Home service assistant</td>
<td>27 100</td>
<td>27 400</td>
</tr>
</table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.